Re: [PATCH v3 26/27] staging: iio: resolver: ad2s1210: implement fault events

kernel test robot
2023-09-30T03:56:40Z

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 5e99f692d4e32e3250ab18d511894ca797407aec]

url: https://github.com/intel-lab-lkp/linux/commits/David-Lechner/dt-bindings-iio-resolver-add-devicetree-bindings-for-ad2s1210/20230930-014031
base: 5e99f692d4e32e3250ab18d511894ca797407aec
patch link: https://lore.kernel.org/r/20230929-ad2s1210-mainline-v3-26-fa4364281745%40baylibre.com
patch subject: [PATCH v3 26/27] staging: iio: resolver: ad2s1210: implement fault events
config: i386-randconfig-003-20230930 (https://download.01.org/0day-ci/archive/20230930/202309301112.XWUnLqJ3-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230930/202309301112.XWUnLqJ3-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309301112.XWUnLqJ3-lkp@intel.com/

All warnings (new ones prefixed by >>):

drivers/staging/iio/resolver/ad2s1210.c:1452:34: warning: 'ad2s1210_of_match' defined but not used [-Wunused-const-variable=]
1452 | static const struct of_device_id ad2s1210_of_match[] = {
| ^~~~~~~~~~~~~~~~~
drivers/staging/iio/resolver/ad2s1210.c: In function 'ad2s1210_read_raw':
>> drivers/staging/iio/resolver/ad2s1210.c:436:40: warning: array subscript 2 is above array bounds of 'u8[2]' {aka 'unsigned char[2]'} [-Warray-bounds]
436 | ad2s1210_push_events(indio_dev, st->rx[2], timestamp);
| ~~~~~~^~~

vim +436 drivers/staging/iio/resolver/ad2s1210.c

390
391 static int ad2s1210_single_conversion(struct iio_dev *indio_dev,
392 struct iio_chan_spec const *chan,
393 int *val)
394 {
395 struct ad2s1210_state *st = iio_priv(indio_dev);
396 s64 timestamp;
397 int ret;
398
399 mutex_lock(&st->lock);
400 gpiod_set_value(st->sample_gpio, 1);
401 timestamp = iio_get_time_ns(indio_dev);
402 /* delay (6 * tck + 20) nano seconds */
403 udelay(1);
404
405 switch (chan->type) {
406 case IIO_ANGL:
407 ret = ad2s1210_set_mode(st, MOD_POS);
408 break;
409 case IIO_ANGL_VEL:
410 ret = ad2s1210_set_mode(st, MOD_VEL);
411 break;
412 default:
413 ret = -EINVAL;
414 break;
415 }
416 if (ret < 0)
417 goto error_ret;
418 ret = spi_read(st->sdev, &st->sample, 3);
419 if (ret < 0)
420 goto error_ret;
421
422 switch (chan->type) {
423 case IIO_ANGL:
424 *val = be16_to_cpu(st->sample.raw);
425 ret = IIO_VAL_INT;
426 break;
427 case IIO_ANGL_VEL:
428 *val = (s16)be16_to_cpu(st->sample.raw);
429 ret = IIO_VAL_INT;
430 break;
431 default:
432 ret = -EINVAL;
433 break;
434 }
435
> 436 ad2s1210_push_events(indio_dev, st->rx[2], timestamp);
437
438 error_ret:
439 gpiod_set_value(st->sample_gpio, 0);
440 /* delay (2 * tck + 20) nano seconds */
441 udelay(1);
442 mutex_unlock(&st->lock);
443 return ret;
444 }
445

--
0-DAY CI Kernel Test Service