Re: [PATCH v4 1/2] HID: hid-goodix: Add Goodix HID-over-SPI driver

From: kernel test robot
Date: Sat Jun 15 2024 - 07:58:42 EST


Hi Charles,

kernel test robot noticed the following build warnings:

[auto build test WARNING on hid/for-next]
[also build test WARNING on dtor-input/next dtor-input/for-linus robh/for-next linus/master v6.10-rc3 next-20240613]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Charles-Wang/HID-hid-goodix-Add-Goodix-HID-over-SPI-driver/20240614-201949
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link: https://lore.kernel.org/r/20240614121538.236727-2-charles.goodix%40gmail.com
patch subject: [PATCH v4 1/2] HID: hid-goodix: Add Goodix HID-over-SPI driver
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20240615/202406151920.jSO2jara-lkp@xxxxxxxxx/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240615/202406151920.jSO2jara-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406151920.jSO2jara-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/device.h:15,
from include/linux/input.h:19,
from include/linux/hid.h:24,
from drivers/hid/hid-goodix-spi.c:9:
drivers/hid/hid-goodix-spi.c: In function 'goodix_spi_read':
>> drivers/hid/hid-goodix-spi.c:147:34: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
147 | dev_err(ts->dev, "read data len exceed limit %ld",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:154:56: note: in expansion of macro 'dev_fmt'
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/hid/hid-goodix-spi.c:147:17: note: in expansion of macro 'dev_err'
147 | dev_err(ts->dev, "read data len exceed limit %ld",
| ^~~~~~~
drivers/hid/hid-goodix-spi.c:147:64: note: format string is defined here
147 | dev_err(ts->dev, "read data len exceed limit %ld",
| ~~^
| |
| long int
| %d
drivers/hid/hid-goodix-spi.c: In function 'goodix_spi_write':
drivers/hid/hid-goodix-spi.c:181:34: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
181 | dev_err(ts->dev, "write data len exceed limit %ld",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:154:56: note: in expansion of macro 'dev_fmt'
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/hid/hid-goodix-spi.c:181:17: note: in expansion of macro 'dev_err'
181 | dev_err(ts->dev, "write data len exceed limit %ld",
| ^~~~~~~
drivers/hid/hid-goodix-spi.c:181:65: note: format string is defined here
181 | dev_err(ts->dev, "write data len exceed limit %ld",
| ~~^
| |
| long int
| %d


vim +147 drivers/hid/hid-goodix-spi.c

137
138 static int goodix_spi_read(struct goodix_ts_data *ts, u32 addr,
139 void *data, size_t len)
140 {
141 struct spi_device *spi = to_spi_device(&ts->spi->dev);
142 struct spi_transfer xfers;
143 struct spi_message spi_msg;
144 int error;
145
146 if (GOODIX_SPI_READ_PREFIX_LEN + len > sizeof(ts->xfer_buf)) {
> 147 dev_err(ts->dev, "read data len exceed limit %ld",
148 sizeof(ts->xfer_buf) - GOODIX_SPI_READ_PREFIX_LEN);
149 return -EINVAL;
150 }
151
152 /* buffer format: 0xF1 + addr(4bytes) + dummy(3bytes) + data */
153 ts->xfer_buf[0] = GOODIX_SPI_READ_FLAG;
154 put_unaligned_be32(addr, ts->xfer_buf + GOODIX_SPI_TRANS_PREFIX_LEN);
155
156 spi_message_init(&spi_msg);
157 memset(&xfers, 0, sizeof(xfers));
158 xfers.tx_buf = ts->xfer_buf;
159 xfers.rx_buf = ts->xfer_buf;
160 xfers.len = GOODIX_SPI_READ_PREFIX_LEN + len;
161 spi_message_add_tail(&xfers, &spi_msg);
162
163 error = spi_sync(spi, &spi_msg);
164 if (error)
165 dev_err(ts->dev, "spi transfer error: %d", error);
166 else
167 memcpy(data, ts->xfer_buf + GOODIX_SPI_READ_PREFIX_LEN, len);
168
169 return error;
170 }
171

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki