mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Chen Ni <nichen@iscas.ac.cn>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (pwm-fan) Add missing check for device_property_read_u32_array
Date: Thu, 29 Jan 2026 06:18:24 -0800	[thread overview]
Message-ID: <2806020e-725a-4da4-8922-e6d28854b53d@roeck-us.net> (raw)
In-Reply-To: <20260128072610.2476625-1-nichen@iscas.ac.cn>

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

      parent reply	other threads:[~2026-01-29 14:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28  7:26 Chen Ni
2026-01-28 10:23 ` Markus Elfring
2026-01-29 14:18 ` Guenter Roeck [this message]

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=2806020e-725a-4da4-8922-e6d28854b53d@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nichen@iscas.ac.cn \
    /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®