From: Joe Perches <joe@perches.com> To: Michael Zaidman <michael.zaidman@gmail.com>, lkp@intel.com Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, jikos@kernel.org, dan.carpenter@oracle.com, linux-input@vger.kernel.org Subject: Re: [PATCH] HID: ft260: fix format type warning in ft260_word_show() Date: Sun, 09 May 2021 13:39:29 -0700 [thread overview] Message-ID: <26e1929386babea33d4a320b506c5247caacde77.camel@perches.com> (raw) In-Reply-To: <20210509193213.5974-1-michael.zaidman@gmail.com> On Sun, 2021-05-09 at 22:32 +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] > return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field)); > ~~~ ^~~~~~~~~~~~~~~~~~~ > %i > include/linux/byteorder/generic.h:91:21: note: expanded from > macro 'le16_to_cpu' > #define le16_to_cpu __le16_to_cpu > ^ > include/uapi/linux/byteorder/big_endian.h:36:26: note: expanded from > macro '__le16_to_cpu' > #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > include/uapi/linux/swab.h:105:2: note: expanded from macro '__swab16' > (__builtin_constant_p((__u16)(x)) ? \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com> > Reported-by: kernel test robot <lkp@intel.com> > --- > drivers/hid/hid-ft260.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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)); > } There are 2 of these so I wonder about the static analysis. It's probably better to use sysfs_emit as well. --- drivers/hid/hid-ft260.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 7a9ba984a75a..475641682fff 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -783,7 +783,7 @@ static int ft260_byte_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", *field); + return sysfs_emit(buf, "%d\n", *field); } static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, @@ -795,7 +795,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 sysfs_emit(buf, "%d\n", le16_to_cpu(*field)); } #define FT260_ATTR_SHOW(name, reptype, id, type, func) \
WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com> To: kbuild-all@lists.01.org Subject: Re: [PATCH] HID: ft260: fix format type warning in ft260_word_show() Date: Sun, 09 May 2021 13:39:29 -0700 [thread overview] Message-ID: <26e1929386babea33d4a320b506c5247caacde77.camel@perches.com> (raw) In-Reply-To: <20210509193213.5974-1-michael.zaidman@gmail.com> [-- Attachment #1: Type: text/plain, Size: 3293 bytes --] On Sun, 2021-05-09 at 22:32 +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] > return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field)); > ~~~ ^~~~~~~~~~~~~~~~~~~ > %i > include/linux/byteorder/generic.h:91:21: note: expanded from > macro 'le16_to_cpu' > #define le16_to_cpu __le16_to_cpu > ^ > include/uapi/linux/byteorder/big_endian.h:36:26: note: expanded from > macro '__le16_to_cpu' > #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > include/uapi/linux/swab.h:105:2: note: expanded from macro '__swab16' > (__builtin_constant_p((__u16)(x)) ? \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com> > Reported-by: kernel test robot <lkp@intel.com> > --- > drivers/hid/hid-ft260.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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)); > } There are 2 of these so I wonder about the static analysis. It's probably better to use sysfs_emit as well. --- drivers/hid/hid-ft260.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 7a9ba984a75a..475641682fff 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -783,7 +783,7 @@ static int ft260_byte_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", *field); + return sysfs_emit(buf, "%d\n", *field); } static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, @@ -795,7 +795,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 sysfs_emit(buf, "%d\n", le16_to_cpu(*field)); } #define FT260_ATTR_SHOW(name, reptype, id, type, func) \
next prev parent reply other threads:[~2021-05-09 20:39 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-05 22:47 drivers/hid/hid-ft260.c:794:44: warning: format specifies type 'short' but the argument has type 'int' kernel test robot 2021-05-05 22:47 ` kernel test robot 2021-05-06 11:55 ` Michael Zaidman 2021-05-06 11:55 ` Michael Zaidman 2021-05-07 10:00 ` [kbuild-all] " Chen, Rong A 2021-05-07 10:00 ` Chen, Rong A 2021-05-09 18:25 ` [kbuild-all] " Michael Zaidman 2021-05-09 18:25 ` Michael Zaidman 2021-05-09 19:32 ` [PATCH] HID: ft260: fix format type warning in ft260_word_show() Michael Zaidman 2021-05-09 19:32 ` Michael Zaidman 2021-05-09 20:39 ` Joe Perches [this message] 2021-05-09 20:39 ` Joe Perches 2021-05-10 9:17 ` Michael Zaidman 2021-05-10 9:17 ` Michael Zaidman 2021-05-10 9:52 ` Joe Perches 2021-05-10 9:52 ` Joe Perches 2021-05-10 10:15 ` Dan Carpenter 2021-05-10 10:15 ` Dan Carpenter 2021-05-10 10:22 ` Dan Carpenter 2021-05-10 10:22 ` Dan Carpenter 2021-05-10 12:51 ` Michael Zaidman 2021-05-10 12:51 ` Michael Zaidman 2021-05-10 16:30 ` [PATCH v2] " Michael Zaidman 2021-05-10 16:30 ` Michael Zaidman 2021-05-10 16:41 ` Joe Perches 2021-05-10 16:41 ` Joe Perches 2021-05-10 16:34 ` [PATCH v3] " Michael Zaidman 2021-05-10 16:34 ` Michael Zaidman
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=26e1929386babea33d4a320b506c5247caacde77.camel@perches.com \ --to=joe@perches.com \ --cc=clang-built-linux@googlegroups.com \ --cc=dan.carpenter@oracle.com \ --cc=jikos@kernel.org \ --cc=kbuild-all@lists.01.org \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=lkp@intel.com \ --cc=michael.zaidman@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.