linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Coverity: ad7476_probe(): Incorrect expression
@ 2020-04-24 15:25 coverity-bot
  2020-04-24 18:25 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 2+ messages in thread
From: coverity-bot @ 2020-04-24 15:25 UTC (permalink / raw)
  To: Dragos Bogdan
  Cc: Beniamin Bia, Jonathan Cameron, Gustavo A. R. Silva, linux-next

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):

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1492717 ("Incorrect expression")
Fixes: 3a6af93dd66e ("iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R")

Thanks for your attention!

-- 
Coverity-bot

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Coverity: ad7476_probe(): Incorrect expression
  2020-04-24 15:25 Coverity: ad7476_probe(): Incorrect expression coverity-bot
@ 2020-04-24 18:25 ` Gustavo A. R. Silva
  0 siblings, 0 replies; 2+ messages in thread
From: Gustavo A. R. Silva @ 2020-04-24 18:25 UTC (permalink / raw)
  To: coverity-bot, Dragos Bogdan; +Cc: Beniamin Bia, Jonathan Cameron, linux-next


This one has already been addressed by Colin:

https://lore.kernel.org/lkml/20200424130419.22940-1-colin.king@canonical.com/

--
Gustavo

On 4/24/20 10:25, coverity-bot wrote:
> 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):
> 
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1492717 ("Incorrect expression")
> Fixes: 3a6af93dd66e ("iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R")
> 
> Thanks for your attention!
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-24 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 15:25 Coverity: ad7476_probe(): Incorrect expression coverity-bot
2020-04-24 18:25 ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).