Coverity: ad7476_probe(): Incorrect expression
Hello!
This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20200424 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:
Wed Mar 11 10:43:26 2020 +0200
3a6af93dd66e ("iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R")Coverity reported the following:
*** CID 1492717: Incorrect expression (NO_EFFECT) /drivers/iio/adc/ad7476.c: 312 in ad7476_probe()
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 vvv CID 1492717: Incorrect expression (NO_EFFECT) vvv Comparing an array to null is not useful: "st->chip_info->convst_channel", since the test will always evaluate as true. 312 if (st->convst_gpio && st->chip_info->convst_channel) 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;
If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first):
Addresses-Coverity-ID: 1492717 ("Incorrect expression")
Thanks for your attention!
Signature · 1 line
Coverity-bot
This one has already been addressed by Colin:
https://lore.kernel.org/lkml/[email protected]/
--
Gustavo
Quoted 42 lines · coverity-bot
Hello!
This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20200424 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scanYou're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:
Wed Mar 11 10:43:26 2020 +0200
3a6af93dd66e ("iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R")Coverity reported the following:
*** CID 1492717: Incorrect expression (
NO_EFFECT) /drivers/iio/adc/ad7476.c: 312 inad7476_probe()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 vvv CID 1492717: Incorrect expression (NO_EFFECT) vvv Comparing an array to null is not useful: "st->chip_info->convst_channel", since the test will always evaluate as true. 312 if (st->convst_gpio && st->chip_info->convst_channel) 313 indio_dev->channels = st->chip_info->convst_channel; 314 /* Setup default message */315
316st->xfer.rx_buf=&st->data;
317st->xfer.len= st->chip_info->channel[0].scan_type.storagebits / 8;If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first):
Reported-by coverity-bot <[email protected]>Addresses-Coverity-ID: 1492717 ("Incorrect expression")
Fixes 3a6af93dd66e ("iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R")Thanks for your attention!