From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: Chen Ni <nichen@iscas.ac.cn>,
haibo.chen@nxp.com, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, linux-iio@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: vf610: Add missing check for device_property_read_u32_array
Date: Thu, 29 Jan 2026 17:40:21 +0000 [thread overview]
Message-ID: <20260129174021.4022306d@jic23-huawei> (raw)
In-Reply-To: <a820c04c224366e31ffbc6d7fe38068f8aab4137.camel@gmail.com>
On Wed, 28 Jan 2026 09:29:47 +0000
Nuno Sá <noname.nuno@gmail.com> wrote:
> On Wed, 2026-01-28 at 12:27 +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/adc/vf610_adc.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
> > index d7182ed0d2a7..d53723ccc5b2 100644
> > --- a/drivers/iio/adc/vf610_adc.c
> > +++ b/drivers/iio/adc/vf610_adc.c
> > @@ -871,7 +871,10 @@ static int vf610_adc_probe(struct platform_device *pdev)
> >
> > info->vref_uv = regulator_get_voltage(info->vref);
> >
> > - device_property_read_u32_array(dev, "fsl,adck-max-frequency", info->max_adck_rate, 3);
> > + ret = device_property_read_u32_array(dev, "fsl,adck-max-frequency",
> > + info->max_adck_rate, 3);
> > + if (ret)
> > + return ret;
>
> As Andy pointed out, this is changing behavior so it needs to be properly justified. Also since we
> are here, maybe use ARRAY_SIZE(info->max_adck_rate).
>
Given the driver has a fallback for info->max_adck_rate[x] == 0
I think this is intentional. It would be clearer if this had done.
info->max_adck_rate[0] = 8;
info->max_adck_rate[1] = 8;
info->max_adck_rate[2] = 8;
device_property_read_u32_array(dev, "fsl,adck-max-frequency", info->max_adck_rate, 3);
though rather than where it has the fallback in vf610_adc_calculate_rates()
> - Nuno Sá
>
> >
> > info->adc_feature.default_sample_time = DEFAULT_SAMPLE_TIME;
> > device_property_read_u32(dev, "min-sample-time", &info->adc_feature.default_sample_time);
next prev parent reply other threads:[~2026-01-29 17:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 4:27 Chen Ni
2026-01-28 6:02 ` Bough Chen
2026-01-28 9:09 ` Andy Shevchenko
2026-01-28 9:29 ` Nuno Sá
2026-01-29 17:40 ` Jonathan Cameron [this message]
2026-01-30 5:25 ` 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=20260129174021.4022306d@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=haibo.chen@nxp.com \
--cc=imx@lists.linux.dev \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nichen@iscas.ac.cn \
--cc=noname.nuno@gmail.com \
--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®