* [bug report] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R
@ 2020-05-01 9:44 Dan Carpenter
2020-05-01 10:11 ` Ardelean, Alexandru
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-05-01 9:44 UTC (permalink / raw)
To: dragos.bogdan; +Cc: linux-iio
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R
2020-05-01 9:44 [bug report] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R Dan Carpenter
@ 2020-05-01 10:11 ` Ardelean, Alexandru
0 siblings, 0 replies; 2+ messages in thread
From: Ardelean, Alexandru @ 2020-05-01 10:11 UTC (permalink / raw)
To: dan.carpenter@oracle.com, Bogdan, Dragos; +Cc: linux-iio@vger.kernel.org
On Fri, 2020-05-01 at 12:44 +0300, Dan Carpenter wrote:
> [External]
>
> 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.
I think there's already a patch applied for this.
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=testing&id=4d22ab7446c69f7ebbc8c8a486ebd9aba68823c0
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-01 10:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-01 9:44 [bug report] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R Dan Carpenter
2020-05-01 10:11 ` Ardelean, Alexandru
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox