Re: [kbuild-all] Re: drivers/hid/hid-ft260.c:794:44: warning: format specifies type 'short' but the argument has type 'int'

From: Michael Zaidman
Date: Sun May 09 2021 - 14:27:48 EST


On Fri, May 07, 2021 at 06:00:31PM +0800, Chen, Rong A wrote:
>
>
> On 5/6/2021 7:55 PM, Michael Zaidman wrote:
> > On Thu, May 06, 2021 at 06:47:46AM +0800, kernel test robot wrote:
> > >
> > > drivers/hid/hid-ft260.c:515:59: warning: variable 'len' is uninitialized when used here [-Wuninitialized]
> > > hid_err(hdev, "%s: unsupported wr len: %d\n", __func__, len);
> > > ^~~
> > > include/linux/hid.h:1190:30: note: expanded from macro 'hid_err'
> > > dev_err(&(hid)->dev, fmt, ##__VA_ARGS__)
> > > ^~~~~~~~~~~
> > > include/linux/dev_printk.h:112:32: note: expanded from macro 'dev_err'
> > > _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > ^~~~~~~~~~~
> > > drivers/hid/hid-ft260.c:507:9: note: initialize the variable 'len' to silence this warning
> > > int len, ret;
> > > ^
> > > = 0
> >
> > This warning has already been found and fixed by Dan Carpenter in
> > the "HID: ft260: fix an error message in ft260_i2c_write_read()" commit
> > on March 18, 2021.
>
> Hi Michael,
>
> This report is about the below warning prefixed by '>>', it's still in
> mainline:
>
> >> 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
>
> Best Regards,
> Rong Chen

Hi Rong,

Sure, but since the report states - "2 warnings generated", I addressed
the first one for which we already have a commit with the fix.

I tried to reproduce the second warning you referred to in this e-mail,
but make.cross script failed since the "clang-latest" directory does not
exist under the "0day". As a workaround, I modified the make command
generated by the script replacing all "clang-latest" occurrences with
"clang" and run it manually.

Another workaround could be to use the symbolic link as reported in the
https://groups.google.com/g/clang-built-linux/c/qCjZblHi8lY/m/eBEEl2JxBgAJ
on March 27, 2021.

Anyway, I reproduced this warning and am going to submit a fix shortly.

Thanks,
Michael