linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Jialin Zhang <zhangjialin11@huawei.com>
Cc: j.neuschaefer@gmx.net, linus.walleij@linaro.org,
	openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
Date: Thu, 17 Mar 2022 12:24:35 +0100	[thread overview]
Message-ID: <YjMac/pwFH5Z+Lxs@latitude> (raw)
In-Reply-To: <20220317065851.495394-1-zhangjialin11@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

On Thu, Mar 17, 2022 at 02:58:51PM +0800, Jialin Zhang wrote:
> In case of error, the function devm_platform_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().

Right.

> 
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index 661aa963e3fc..a71b684b9b44 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  	int ret;
>  
>  	pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (!pctrl->gpio_base)
> -		return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
> +	if (IS_ERR(pctrl->gpio_base))
> +		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
> +				     "Resource fail for GPIO controller\n");
>  

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>


Thanks!
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-03-17 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  6:58 [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register() Jialin Zhang
2022-03-17 11:24 ` Jonathan Neuschäfer [this message]
2022-03-24  0:39 ` Linus Walleij

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=YjMac/pwFH5Z+Lxs@latitude \
    --to=j.neuschaefer@gmx.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=zhangjialin11@huawei.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).