aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAngelo Dureghello <adureghello@baylibre.com>2025-06-06 16:19:20 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2025-06-09 07:45:37 +0100
commit9dc4ef3a5b9f6b28f27aa29977049c84cdec4755 (patch)
treef8de22b0f94850fc76ea379274c6dabad2b7e4d5
parentdt-bindings: iio: adc: adi,ad7606: add gain calibration support (diff)
downloadwireguard-linux-9dc4ef3a5b9f6b28f27aa29977049c84cdec4755.tar.xz
wireguard-linux-9dc4ef3a5b9f6b28f27aa29977049c84cdec4755.zip
iio: adc: ad7606: exit for invalid fdt dt_schema properties
Fix ad7606_get_chan_config() fdt parsing function to exit for error in case of invalid dt_schema values. Idea is to not proceed when there are values that are not allowed under the dt_schema. Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20250606-wip-bl-ad7606-calibration-v9-5-6e014a1f92a2@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/adc/ad7606.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index f0c22365f23f..e5878974a282 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -319,15 +319,13 @@ static int ad7606_get_chan_config(struct iio_dev *indio_dev, int ch,
ret = fwnode_property_read_u32(child, "reg", &reg);
if (ret)
- continue;
+ return ret;
/* channel number (here) is from 1 to num_channels */
- if (reg < 1 || reg > num_channels) {
- dev_warn(dev,
- "Invalid channel number (ignoring): %d\n", reg);
- continue;
- }
+ if (reg < 1 || reg > num_channels)
+ return -EINVAL;
+ /* Loop until we are in the right channel. */
if (reg != (ch + 1))
continue;