[PATCH] iio: addac: ad74115: Add missing check for device_property_read_u32_array

From: Chen Ni

Date: Tue Jan 27 2026 - 23:32:02 EST


Add check for the return value of device_property_read_u32_array() and
return the error if it fails in order to catch the error.

Signed-off-by: Chen Ni <nichen@xxxxxxxxxxx>
---
drivers/iio/addac/ad74115.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/addac/ad74115.c b/drivers/iio/addac/ad74115.c
index f8b04d86b01f..d0d6c0575ff1 100644
--- a/drivers/iio/addac/ad74115.c
+++ b/drivers/iio/addac/ad74115.c
@@ -1515,8 +1515,12 @@ static int ad74115_setup_adc_conv2_range(struct ad74115_state *st)
};
struct device *dev = &st->spi->dev;
unsigned int i;
+ int ret;

- device_property_read_u32_array(dev, prop_name, vals, 2);
+ ret = device_property_read_u32_array(dev, prop_name, vals, 2);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to read %s prop\n",
+ prop_name);

for (i = 0; i < tbl_len; i++)
if (vals[0] == ad74115_adc_range_tbl[i][0] &&
--
2.25.1