iio: adc: qcom-spmi-adc5: Verify channel numbers from DT
authorMatthias Kaehlcke <mka@chromium.org>
Mon, 27 Aug 2018 21:14:53 +0000 (14:14 -0700)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 2 Sep 2018 17:52:04 +0000 (18:52 +0100)
commit1e46774fec4b54adbd7cc15f1931e9df98664530
treeda285d24b61eeb631ae9aa96557f0e5def4a0757
parent21eab7861688aa4c69fcb88440cc0c4a422bdcd6
iio: adc: qcom-spmi-adc5: Verify channel numbers from DT

The driver only defines a subset of all possible ADC channels. Channel
numbers read from the device tree are accepted as long as they don't
exceed a max value, even when no channel definition exists. Add a
check to abort initialization in this case.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/qcom-spmi-adc5.c