[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250526-wip-bl-ad7606-calibration-v7-5-b487022ce199@baylibre.com>
Date: Mon, 26 May 2025 12:03:20 +0200
From: Angelo Dureghello <adureghello@...libre.com>
To: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Hennerich <michael.hennerich@...log.com>,
devicetree@...r.kernel.org, Angelo Dureghello <adureghello@...libre.com>
Subject: [PATCH v7 5/6] iio: adc: ad7606: exit for invalid fdt dt_schema
properties
From: Angelo Dureghello <adureghello@...libre.com>
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@...libre.com>
---
drivers/iio/adc/ad7606.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index 9a9bef0cfbb37138f71ba5b1babeaa423eaf4d5a..e0a666cc0e14255754e74daa9e1e88bc4ad1665c 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", ®);
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;
--
2.49.0
Powered by blists - more mailing lists