Re: [PATCH v2] HID: ft260: fix format type warning in ft260_word_show()

From: Joe Perches
Date: Mon May 10 2021 - 12:42:07 EST


On Mon, 2021-05-10 at 19:30 +0300, Michael Zaidman wrote:
> Fixes: 6a82582d9fa4 ("HID: ft260: add usb hid to i2c host bridge driver")
>
> Fix warning reported by static analysis when built with W=1 for arm64 by
> clang version 13.0.0
>
> > > drivers/hid/hid-ft260.c:794:44: warning: format specifies type 'short' but
>    the argument has type 'int' [-Wformat]
[]
> diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c
[]
> @@ -791,7 +791,7 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
>   if (ret != len && ret >= 0)
>   return -EIO;
>  
>
> - return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field));
> + return scnprintf(buf, PAGE_SIZE, "%d\n", le16_to_cpu(*field));
>  }

This is likely a clang defect and not an actual problem.
If you are going to convert one of these, convert both.