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: etremblay@distech-controls.com, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (tmp513) Add missing check for device_property_read_u32_array
Date: Thu, 29 Jan 2026 06:20:57 -0800	[thread overview]
Message-ID: <7ade6258-8df6-483b-9f55-3d38e9a50cb3@roeck-us.net> (raw)
In-Reply-To: <20260128073021.2476709-1-nichen@iscas.ac.cn>

On Wed, Jan 28, 2026 at 03:30:21PM +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/tmp513.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
> index 5acbfd7d088d..f201d0a9ba14 100644
> --- a/drivers/hwmon/tmp513.c
> +++ b/drivers/hwmon/tmp513.c
> @@ -676,8 +676,10 @@ static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)
>  	if (ret < 0)
>  		return ret;
>  
> -	device_property_read_u32_array(dev, "ti,nfactor", data->nfactor,
> -				       data->max_channels - 1);
> +	ret = device_property_read_u32_array(dev, "ti,nfactor", data->nfactor,
> +					     data->max_channels - 1);
> +	if (ret)
> +		return ret;

NACK. The default is 0, and the property is optional.

Guenter

>  
>  	// Check if shunt value is compatible with pga-gain
>  	if (data->shunt_uohms > data->pga_gain * 40 * MICRO) {
> -- 
> 2.25.1
> 
> 

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28  7:30 Chen Ni
2026-01-28 10:28 ` Markus Elfring
2026-01-29 14:20 ` 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=7ade6258-8df6-483b-9f55-3d38e9a50cb3@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=etremblay@distech-controls.com \
    --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®