public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Kai Song <songkai01@inspur.com>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (xgene) fix return value in xgene_hwmon_probe()
Date: Sat, 23 Oct 2021 16:47:45 -0700	[thread overview]
Message-ID: <20211023234745.GA3703155@roeck-us.net> (raw)
In-Reply-To: <20211022084446.16728-1-songkai01@inspur.com>

On Fri, Oct 22, 2021 at 04:44:46PM +0800, Kai Song wrote:
> It uses IS_ERR to judge the return value of mbox_request_channel()
> and pcc_mbox_request_channel().If it is invalid, maybe we should
> use PTR_ERR to get the correct return value.
> 

Only if the error reflects something else than -ENODEV, ie than
a missing device.

Guenter

> Signed-off-by: Kai Song <songkai01@inspur.com>
> ---
>  drivers/hwmon/xgene-hwmon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c
> index 382ef0395d8e..fd0847f251c0 100644
> --- a/drivers/hwmon/xgene-hwmon.c
> +++ b/drivers/hwmon/xgene-hwmon.c
> @@ -648,7 +648,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
>  		if (IS_ERR(ctx->mbox_chan)) {
>  			dev_err(&pdev->dev,
>  				"SLIMpro mailbox channel request failed\n");
> -			rc = -ENODEV;
> +			rc = PTR_ERR(ctx->mbox_chan);
>  			goto out_mbox_free;
>  		}
>  	} else {
> @@ -675,7 +675,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
>  		if (IS_ERR(ctx->mbox_chan)) {
>  			dev_err(&pdev->dev,
>  				"PPC channel request failed\n");
> -			rc = -ENODEV;
> +			rc = PTR_ERR(ctx->mbox_chan);
>  			goto out_mbox_free;
>  		}
>  
> -- 
> 2.27.0
> 

      reply	other threads:[~2021-10-23 23:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  8:44 [PATCH] hwmon: (xgene) fix return value in xgene_hwmon_probe() Kai Song
2021-10-23 23:47 ` 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=20211023234745.GA3703155@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=songkai01@inspur.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