Arnd Bergmann
unread,May 5, 2020, 10:24:12 AM5/5/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron, Dragos Bogdan, Beniamin Bia, Arnd Bergmann, Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler, linu...@vger.kernel.org, linux-...@vger.kernel.org, clang-bu...@googlegroups.com
Checking the pointer value of st->chip_info->convst_channel is pointless
since this this an array inside of a struct: even if st->chip_info is NULL,
the pointer is non-zero. Clang warns about this:
drivers/iio/adc/ad7476.c:312:40: warning: address of array 'st->chip_info->convst_channel' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (st->convst_gpio && st->chip_info->convst_channel)
~~ ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
I could not come up with a sane way to check whether the entry
is valid, so just remove the check and keep the behavior as it
is today but without the warning.
Fixes: 3a6af93dd66e ("iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R")
Signed-off-by: Arnd Bergmann <
ar...@arndb.de>
---
drivers/iio/adc/ad7476.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index e9984a38fc4c..4e816d714ad2 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
indio_dev->num_channels = 2;
indio_dev->info = &ad7476_info;
- if (st->convst_gpio && st->chip_info->convst_channel)
+ if (st->convst_gpio)
indio_dev->channels = st->chip_info->convst_channel;
/* Setup default message */
--
2.26.0