LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Sudeep Holla <sudeep.holla@arm.com>, linux-kernel@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH -next] hwmon: (scmi) return -EINVAL when sensor information is unavailable
Date: Thu, 15 Mar 2018 14:27:21 -0700	[thread overview]
Message-ID: <91ffbe33-29c7-9836-283c-0c6c13c60b1e@roeck-us.net> (raw)
In-Reply-To: <1521137299-31363-1-git-send-email-sudeep.holla@arm.com>

On 03/15/2018 11:08 AM, Sudeep Holla wrote:
> Passing NULL pointer to PTR_ERR will result in return value of 0
> indicating success which is clearly not what it is intended here.
> 
> This patch returns -EINVAL instead when the sensor information is not
> available.
> 
> Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/hwmon/scmi-hwmon.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Hi Guenter,
> 
> I will try to push this via ARM-SoC if possible before v4.17 merge window.
> So please provide Ack if you are fine.
> 
> Regards,
> Sudeep
> 
> diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
> index 32e750373ced..363bf56eb0f2 100644
> --- a/drivers/hwmon/scmi-hwmon.c
> +++ b/drivers/hwmon/scmi-hwmon.c
> @@ -138,7 +138,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
>   	for (i = 0; i < nr_sensors; i++) {
>   		sensor = handle->sensor_ops->info_get(handle, i);
>   		if (!sensor)
> -			return PTR_ERR(sensor);
> +			return -EINVAL;
>   
>   		switch (sensor->type) {
>   		case TEMPERATURE_C:
> 

      reply	other threads:[~2018-03-15 21:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 18:08 [PATCH -next] hwmon: (scmi) return -EINVAL when sensor information is unavailable Sudeep Holla
2018-03-15 21:27 ` 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=91ffbe33-29c7-9836-283c-0c6c13c60b1e@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.holla@arm.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;
as well as URLs for NNTP newsgroup(s).