linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Nilsson <jesper.nilsson@axis.com>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: Jesper Nilsson <jespern@axis.com>, Lars Persson <larper@axis.com>,
	Niklas Cassel <niklass@axis.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Wei Yongjun <weiyongjun1@huawei.com>,
	linux-arm-kernel@axis.com, linux-gpio@vger.kernel.org
Subject: Re: [PATCH -next v2] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
Date: Tue, 25 Apr 2017 15:40:00 +0200	[thread overview]
Message-ID: <20170425134000.GN18509@axis.com> (raw)
In-Reply-To: <20170425112930.19555-1-weiyj.lk@gmail.com>

On Tue, Apr 25, 2017 at 11:29:30AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> In case of error, the function pinctrl_register() returns
> ERR_PTR() not NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

Although I'm wondering if moving to pinctrl_register_and_init()
would sense here. Linus?

/Jesper

> ---
> v1 -> v2: fix comment
> ---
>  drivers/pinctrl/pinctrl-artpec6.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-artpec6.c b/drivers/pinctrl/pinctrl-artpec6.c
> index b5a2eff..6a16019 100644
> --- a/drivers/pinctrl/pinctrl-artpec6.c
> +++ b/drivers/pinctrl/pinctrl-artpec6.c
> @@ -938,9 +938,9 @@ static int artpec6_pmx_probe(struct platform_device *pdev)
>  	pmx->num_pin_groups = ARRAY_SIZE(artpec6_pin_groups);
>  	pmx->pctl	    = pinctrl_register(&artpec6_desc, &pdev->dev, pmx);
>  
> -	if (!pmx->pctl) {
> +	if (IS_ERR(pmx->pctl)) {
>  		dev_err(&pdev->dev, "could not register pinctrl driver\n");
> -		return -EINVAL;
> +		return PTR_ERR(pmx->pctl);
>  	}
>  
>  	platform_set_drvdata(pdev, pmx);

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

  reply	other threads:[~2017-04-25 13:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  3:29 [PATCH -next] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe() Wei Yongjun
2017-04-25  8:31 ` Jesper Nilsson
2017-04-25  9:18   ` weiyongjun (A)
2017-04-25 11:29 ` [PATCH -next v2] " Wei Yongjun
2017-04-25 13:40   ` Jesper Nilsson [this message]
2017-04-28  7:43     ` Linus Walleij
2017-04-28  7:58       ` Jesper Nilsson
2017-04-28 14:26         ` Tony Lindgren
2017-04-28  7:41   ` 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=20170425134000.GN18509@axis.com \
    --to=jesper.nilsson@axis.com \
    --cc=jespern@axis.com \
    --cc=larper@axis.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@axis.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=niklass@axis.com \
    --cc=weiyj.lk@gmail.com \
    --cc=weiyongjun1@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).