summaryrefslogtreecommitdiff
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorFabrice Gasnier <fabrice.gasnier@st.com>2017-09-18 18:24:15 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-09-24 14:07:28 +0100
commit4fb840c95f82652cece7352be9080884cafb92a0 (patch)
tree30bf40cf9ff3014834d3e2d85c7f52a7be7dcd96 /drivers/iio/adc
parentb7a9776c1f9443326632486fcbd82dca82f8511e (diff)
iio: adc: stm32: fix bad error check on max_channels
Fix a bad error check when counting 'st,adc-channels' array elements. This is seen when all channels are in use simultaneously. Fixes: 64ad7f643 ("iio: adc: stm32: introduce compatible data cfg") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/stm32-adc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 6bc602891f2f..e93244bc3edd 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -1656,7 +1656,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;
}