[bug report] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dragos Bogdan,

The patch 3a6af93dd66e: "iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for
AD7091R" from Mar 11, 2020, leads to the following static checker
warning:

	drivers/iio/adc/ad7476.c:312 ad7476_probe()
	warn: this array is non-NULL. 'st->chip_info->convst_channel'

drivers/iio/adc/ad7476.c
   288          ret = devm_add_action_or_reset(&spi->dev, ad7476_reg_disable,
   289                                         st);
   290          if (ret)
   291                  return ret;
   292  
   293          st->convst_gpio = devm_gpiod_get_optional(&spi->dev,
   294                                                    "adi,conversion-start",
   295                                                    GPIOD_OUT_LOW);
   296          if (IS_ERR(st->convst_gpio))
   297                  return PTR_ERR(st->convst_gpio);
   298  
   299          spi_set_drvdata(spi, indio_dev);
   300  
   301          st->spi = spi;
   302  
   303          /* Establish that the iio_dev is a child of the spi device */
   304          indio_dev->dev.parent = &spi->dev;
   305          indio_dev->dev.of_node = spi->dev.of_node;
   306          indio_dev->name = spi_get_device_id(spi)->name;
   307          indio_dev->modes = INDIO_DIRECT_MODE;
   308          indio_dev->channels = st->chip_info->channel;
   309          indio_dev->num_channels = 2;
   310          indio_dev->info = &ad7476_info;
   311  
   312          if (st->convst_gpio && st->chip_info->convst_channel)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is an array, not a pointer and it it's in the middle of the struct
so it can't possibly be NULL.

   313                  indio_dev->channels = st->chip_info->convst_channel;
   314          /* Setup default message */
   315  
   316          st->xfer.rx_buf = &st->data;
   317          st->xfer.len = st->chip_info->channel[0].scan_type.storagebits / 8;
   318  
   319          spi_message_init(&st->msg);
   320          spi_message_add_tail(&st->xfer, &st->msg);
   321  

regards,
dan carpenter



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux