Message ID | 20210510163029.2217-1-michael.zaidman@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Jiri Kosina |
Headers | show |
Series | [v2] HID: ft260: fix format type warning in ft260_word_show() | expand |
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.
diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 047aa85a7c83..38794a29599c 100644 --- 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)); } #define FT260_ATTR_SHOW(name, reptype, id, type, func) \