[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260129174021.4022306d@jic23-huawei>
Date: Thu, 29 Jan 2026 17:40:21 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Nuno Sá <noname.nuno@...il.com>
Cc: Chen Ni <nichen@...as.ac.cn>, haibo.chen@....com, dlechner@...libre.com,
nuno.sa@...log.com, andy@...nel.org, linux-iio@...r.kernel.org,
imx@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: vf610: Add missing check for
device_property_read_u32_array
On Wed, 28 Jan 2026 09:29:47 +0000
Nuno Sá <noname.nuno@...il.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@...as.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);
Powered by blists - more mailing lists