mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Chen Ni <nichen@iscas.ac.cn>,
	lars@metafoo.de, Michael.Hennerich@analog.com,
		cosmin.tanislav@analog.com, jic23@kernel.org,
	dlechner@baylibre.com, 	nuno.sa@analog.com, andy@kernel.org
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: addac: ad74115: Add missing check for device_property_read_u32_array
Date: Wed, 28 Jan 2026 09:34:18 +0000	[thread overview]
Message-ID: <5b0471519e4fdefd41c5d951401483cde3e49f19.camel@gmail.com> (raw)
In-Reply-To: <20260128043040.2260887-1-nichen@iscas.ac.cn>

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@iscas.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á
> 

  reply	other threads:[~2026-01-28  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28  4:30 Chen Ni
2026-01-28  9:34 ` Nuno Sá [this message]
2026-01-28  9:41   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b0471519e4fdefd41c5d951401483cde3e49f19.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=cosmin.tanislav@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nichen@iscas.ac.cn \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®