[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b0471519e4fdefd41c5d951401483cde3e49f19.camel@gmail.com>
Date: Wed, 28 Jan 2026 09:34:18 +0000
From: Nuno Sá <noname.nuno@...il.com>
To: Chen Ni <nichen@...as.ac.cn>, lars@...afoo.de,
Michael.Hennerich@...log.com, cosmin.tanislav@...log.com,
jic23@...nel.org, dlechner@...libre.com, nuno.sa@...log.com,
andy@...nel.org
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: addac: ad74115: Add missing check for
device_property_read_u32_array
On Wed, 2026-01-28 at 12:30 +0800, Chen Ni wrote:
> 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@...as.ac.cn>
> ---
> 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);
Thanks for the patch but this is intentional. Not a mandatory property. If you want, you could
do
if (ret && ret != -EINVAL)
return dev_err_probe()
Not 100% sure if that is the proper error code but the goal is to only error out in case the
property __is__ present but wrong. However we are kind of relaxed with the above in IIO.
- Nuno Sá
>
Powered by blists - more mailing lists