[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2806020e-725a-4da4-8922-e6d28854b53d@roeck-us.net>
Date: Thu, 29 Jan 2026 06:18:24 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Chen Ni <nichen@...as.ac.cn>
Cc: linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (pwm-fan) Add missing check for
device_property_read_u32_array
On Wed, Jan 28, 2026 at 03:26:10PM +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/hwmon/pwm-fan.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
> index 37269db2de84..3535007f5c37 100644
> --- a/drivers/hwmon/pwm-fan.c
> +++ b/drivers/hwmon/pwm-fan.c
> @@ -609,8 +609,11 @@ static int pwm_fan_probe(struct platform_device *pdev)
> for (i = 0; i < ctx->tach_count; i++)
> ctx->pulses_per_revolution[i] = 2;
>
> - device_property_read_u32_array(dev, "pulses-per-revolution",
> - ctx->pulses_per_revolution, ctx->tach_count);
> + ret = device_property_read_u32_array(dev, "pulses-per-revolution",
> + ctx->pulses_per_revolution, ctx->tach_count);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "Failed to read pulses-per-revolution\n");
NACK
This would defeat the purpose of setting the default a couple of lines above.
Guenter
> }
>
> channels = devm_kcalloc(dev, channel_count + 1,
> --
> 2.25.1
>
>
Powered by blists - more mailing lists