Skip to content

Commit 4fb840c

Browse files
Fabrice Gasnierjic23
authored andcommitted
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: 64ad7f6 ("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>
1 parent b7a9776 commit 4fb840c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/adc/stm32-adc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,7 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)
16561656

16571657
num_channels = of_property_count_u32_elems(node, "st,adc-channels");
16581658
if (num_channels < 0 ||
1659-
num_channels >= adc_info->max_channels) {
1659+
num_channels > adc_info->max_channels) {
16601660
dev_err(&indio_dev->dev, "Bad st,adc-channels?\n");
16611661
return num_channels < 0 ? num_channels : -EINVAL;
16621662
}

0 commit comments

Comments
 (0)