All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: stm32: fix bad error check on max_channels
@ 2017-09-18 16:24 ` Fabrice Gasnier
  0 siblings, 0 replies; 4+ messages in thread
From: Fabrice Gasnier @ 2017-09-18 16:24 UTC (permalink / raw)
  To: jic23
  Cc: linux-arm-kernel, linux-kernel, mcoquelin.stm32,
	alexandre.torgue, fabrice.gasnier, benjamin.gaignard,
	benjamin.gaignard, linux-iio, lars, knaack.h, pmeerw

Fix a bad error check when counting 'st,adc-channels' array elements.
This is seen when all channels are in use simultaneously.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/adc/stm32-adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index e3c15f8..4df32cf 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -1666,7 +1666,7 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)
 
 	num_channels = of_property_count_u32_elems(node, "st,adc-channels");
 	if (num_channels < 0 ||
-	    num_channels >= adc_info->max_channels) {
+	    num_channels > adc_info->max_channels) {
 		dev_err(&indio_dev->dev, "Bad st,adc-channels?\n");
 		return num_channels < 0 ? num_channels : -EINVAL;
 	}
-- 
1.9.1

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

end of thread, other threads:[~2017-09-24 13:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18 16:24 [PATCH] iio: adc: stm32: fix bad error check on max_channels Fabrice Gasnier
2017-09-18 16:24 ` Fabrice Gasnier
2017-09-24 13:09 ` Jonathan Cameron
2017-09-24 13:09   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.