Re: [PATCH v5 9/9] drivers: iio: imu: Add support for adis1657x family

From: Jonathan Cameron
Date: Sun Jun 02 2024 - 07:11:20 EST


On Wed, 29 May 2024 17:32:40 +0300
Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> Hi Ramona,
>
> kernel test robot noticed the following build warnings:
>
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Ramona-Gradinariu/dt-bindings-iio-imu-Add-ADIS16501-compatibles/20240527-230203
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> patch link: https://lore.kernel.org/r/20240527142618.275897-10-ramona.bolboaca13%40gmail.com
> patch subject: [PATCH v5 9/9] drivers: iio: imu: Add support for adis1657x family
> config: x86_64-randconfig-161-20240528 (https://download.01.org/0day-ci/archive/20240528/202405281539.EXGy0dhk-lkp@xxxxxxxxx/config)
> compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
>
> 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>
> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> | Closes: https://lore.kernel.org/r/202405281539.EXGy0dhk-lkp@xxxxxxxxx/
>
> smatch warnings:
> drivers/iio/imu/adis16475.c:1608 adis16475_push_single_sample() warn: missing error code? 'ret'
>
> vim +/ret +1608 drivers/iio/imu/adis16475.c
>
> c49e2871e50119 Ramona Gradinariu 2024-05-27 1577 static int adis16475_push_single_sample(struct iio_poll_func *pf)
> fff7352bf7a3ce Nuno Sá 2020-04-13 1578 {
> fff7352bf7a3ce Nuno Sá 2020-04-13 1579 struct iio_dev *indio_dev = pf->indio_dev;
> fff7352bf7a3ce Nuno Sá 2020-04-13 1580 struct adis16475 *st = iio_priv(indio_dev);
> fff7352bf7a3ce Nuno Sá 2020-04-13 1581 struct adis *adis = &st->adis;
> 8f6bc87d67c030 Ramona Bolboaca 2023-08-08 1582 int ret, bit, buff_offset = 0, i = 0;
> fff7352bf7a3ce Nuno Sá 2020-04-13 1583 __be16 *buffer;
> fff7352bf7a3ce Nuno Sá 2020-04-13 1584 u16 crc;
> fff7352bf7a3ce Nuno Sá 2020-04-13 1585 bool valid;
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1586 u8 crc_offset = 9;
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1587 u16 burst_size = ADIS16475_BURST_MAX_DATA;
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1588 u16 start_idx = (st->info->flags & ADIS16475_HAS_TIMESTAMP32) ? 2 : 0;
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1589
> fff7352bf7a3ce Nuno Sá 2020-04-13 1590 /* offset until the first element after gyro and accel */
> fff7352bf7a3ce Nuno Sá 2020-04-13 1591 const u8 offset = st->burst32 ? 13 : 7;
> fff7352bf7a3ce Nuno Sá 2020-04-13 1592
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1593 if (st->burst32) {
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1594 crc_offset = (st->info->flags & ADIS16475_HAS_TIMESTAMP32) ? 16 : 15;
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1595 burst_size = adis->data->burst_max_len;
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1596 }
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1597
> fff7352bf7a3ce Nuno Sá 2020-04-13 1598 ret = spi_sync(adis->spi, &adis->msg);
> fff7352bf7a3ce Nuno Sá 2020-04-13 1599 if (ret)
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1600 return ret;
> fff7352bf7a3ce Nuno Sá 2020-04-13 1601
> fff7352bf7a3ce Nuno Sá 2020-04-13 1602 buffer = adis->buffer;
> fff7352bf7a3ce Nuno Sá 2020-04-13 1603
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1604 crc = be16_to_cpu(buffer[crc_offset]);
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 1605 valid = adis16475_validate_crc(adis->buffer, crc, burst_size, start_idx);
> fff7352bf7a3ce Nuno Sá 2020-04-13 1606 if (!valid) {
> fff7352bf7a3ce Nuno Sá 2020-04-13 1607 dev_err(&adis->spi->dev, "Invalid crc\n");
> 7f174ee4adeb12 Ramona Gradinariu 2024-05-27 @1608 return ret;
> ^^^^^^^^^^
> return -EINVAL
I've gone with this as the fix whilst applying the patch

Thanks,

Jonathan

>
> fff7352bf7a3ce Nuno Sá 2020-04-13 1609 }
> fff7352bf7a3ce Nuno Sá 2020-04-13 1610
> fff7352bf7a3ce Nuno Sá 2020-04-13 1611 for_each_set_bit(bit, indio_dev->active_scan_mask,
> fff7352bf7a3ce Nuno Sá 2020-04-13 1612 indio_dev->masklength) {
> fff7352bf7a3ce Nuno Sá 2020-04-13 1613 /*
> fff7352bf7a3ce Nuno Sá 2020-04-13 1614 * When burst mode is used, system flags is the first data
> fff7352bf7a3ce Nuno Sá 2020-04-13 1615 * channel in the sequence, but the scan index is 7.
> fff7352bf7a3ce Nuno Sá 2020-04-13 1616 */
>