* [PATCH -next] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
@ 2017-04-25 3:29 Wei Yongjun
2017-04-25 8:31 ` Jesper Nilsson
2017-04-25 11:29 ` [PATCH -next v2] " Wei Yongjun
0 siblings, 2 replies; 9+ messages in thread
From: Wei Yongjun @ 2017-04-25 3:29 UTC (permalink / raw)
To: Jesper Nilsson, Lars Persson, Niklas Cassel, Linus Walleij
Cc: Wei Yongjun, linux-arm-kernel, linux-gpio
From: Wei Yongjun <weiyongjun1@huawei.com>
In case of error, the function pinctrl_register() returns
NULL not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
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);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH -next] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
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
1 sibling, 1 reply; 9+ messages in thread
From: Jesper Nilsson @ 2017-04-25 8:31 UTC (permalink / raw)
To: Wei Yongjun
Cc: Jesper Nilsson, Lars Persson, Niklas Cassel, Linus Walleij,
Wei Yongjun, linux-arm-kernel, linux-gpio
On Tue, Apr 25, 2017 at 03:29:45AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> In case of error, the function pinctrl_register() returns
> NULL not ERR_PTR(). The IS_ERR() test in the return value
> check should be replaced with NULL test.
Uh, the comment above reads as the exact opposite
of what the patch does. Your point is valid though,
but the comment needs rephrasing.
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
/Jesper
> ---
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH -next] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
2017-04-25 8:31 ` Jesper Nilsson
@ 2017-04-25 9:18 ` weiyongjun (A)
0 siblings, 0 replies; 9+ messages in thread
From: weiyongjun (A) @ 2017-04-25 9:18 UTC (permalink / raw)
To: Jesper Nilsson, Wei Yongjun
Cc: Jesper Nilsson, Lars Persson, Niklas Cassel, Linus Walleij,
linux-arm-kernel@axis.com, linux-gpio@vger.kernel.org
> -----Original Message-----
> From: Jesper Nilsson [mailto:jesper.nilsson@axis.com]
> Sent: Tuesday, April 25, 2017 4:31 PM
> 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>;
> weiyongjun (A) <weiyongjun1@huawei.com>; linux-arm-kernel@axis.com;
> linux-gpio@vger.kernel.org
> Subject: Re: [PATCH -next] pinctrl: artpec6: Fix return value check in
> artpec6_pmx_probe()
>
> On Tue, Apr 25, 2017 at 03:29:45AM +0000, Wei Yongjun wrote:
> > From: Wei Yongjun <weiyongjun1@huawei.com>
> >
> > In case of error, the function pinctrl_register() returns
> > NULL not ERR_PTR(). The IS_ERR() test in the return value
> > check should be replaced with NULL test.
>
> Uh, the comment above reads as the exact opposite
> of what the patch does. Your point is valid though,
> but the comment needs rephrasing.
>
Oh, sorry, I will send the v2 patch with comment fixed soon.
Thanks.
Wei Yongjun
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH -next v2] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
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 11:29 ` Wei Yongjun
2017-04-25 13:40 ` Jesper Nilsson
2017-04-28 7:41 ` Linus Walleij
1 sibling, 2 replies; 9+ messages in thread
From: Wei Yongjun @ 2017-04-25 11:29 UTC (permalink / raw)
To: Jesper Nilsson, Lars Persson, Niklas Cassel, Linus Walleij
Cc: Wei Yongjun, linux-arm-kernel, linux-gpio
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>
---
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);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH -next v2] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
2017-04-25 11:29 ` [PATCH -next v2] " Wei Yongjun
@ 2017-04-25 13:40 ` Jesper Nilsson
2017-04-28 7:43 ` Linus Walleij
2017-04-28 7:41 ` Linus Walleij
1 sibling, 1 reply; 9+ messages in thread
From: Jesper Nilsson @ 2017-04-25 13:40 UTC (permalink / raw)
To: Wei Yongjun
Cc: Jesper Nilsson, Lars Persson, Niklas Cassel, Linus Walleij,
Wei Yongjun, linux-arm-kernel, linux-gpio
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH -next v2] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
2017-04-25 13:40 ` Jesper Nilsson
@ 2017-04-28 7:43 ` Linus Walleij
2017-04-28 7:58 ` Jesper Nilsson
0 siblings, 1 reply; 9+ messages in thread
From: Linus Walleij @ 2017-04-28 7:43 UTC (permalink / raw)
To: Jesper Nilsson, ext Tony Lindgren
Cc: Wei Yongjun, Jesper Nilsson, Lars Persson, Niklas Cassel,
Wei Yongjun, linux-arm-kernel, linux-gpio@vger.kernel.org
On Tue, Apr 25, 2017 at 3:40 PM, Jesper Nilsson <jesper.nilsson@axis.com> wrote:
> 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?
That depends, check on the commits introducing it for the
usecase.
OTOMH it was introduced for when you have hogs in drivers
doing all set-up of groups and functions from the device tree.
Tony?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH -next v2] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
2017-04-28 7:43 ` Linus Walleij
@ 2017-04-28 7:58 ` Jesper Nilsson
2017-04-28 14:26 ` Tony Lindgren
0 siblings, 1 reply; 9+ messages in thread
From: Jesper Nilsson @ 2017-04-28 7:58 UTC (permalink / raw)
To: Linus Walleij
Cc: Jesper Nilsson, ext Tony Lindgren, Wei Yongjun, Lars Persson,
Niklas Cassel, Wei Yongjun, linux-arm-kernel,
linux-gpio@vger.kernel.org
On Fri, Apr 28, 2017 at 09:43:07AM +0200, Linus Walleij wrote:
> On Tue, Apr 25, 2017 at 3:40 PM, Jesper Nilsson <jesper.nilsson@axis.com> wrote:
> > 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?
>
> That depends, check on the commits introducing it for the
> usecase.
>
> OTOMH it was introduced for when you have hogs in drivers
> doing all set-up of groups and functions from the device tree.
Yeah, so in this case it is not necessary, but
the comment above pinctrl_register() explicitly says:
"To avoid issues later on, please use the
new pinctrl_register_and_init() below instead."
Which to me indicates that it is recommended
to use the pinctrl_register_and_init() in future code...
> Tony?
>
> Yours,
> Linus Walleij
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH -next v2] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
2017-04-28 7:58 ` Jesper Nilsson
@ 2017-04-28 14:26 ` Tony Lindgren
0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2017-04-28 14:26 UTC (permalink / raw)
To: Jesper Nilsson
Cc: Linus Walleij, Jesper Nilsson, Wei Yongjun, Lars Persson,
Niklas Cassel, Wei Yongjun, linux-arm-kernel,
linux-gpio@vger.kernel.org
* Jesper Nilsson <jesper.nilsson@axis.com> [170428 01:01]:
> On Fri, Apr 28, 2017 at 09:43:07AM +0200, Linus Walleij wrote:
> > On Tue, Apr 25, 2017 at 3:40 PM, Jesper Nilsson <jesper.nilsson@axis.com> wrote:
> > > 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?
> >
> > That depends, check on the commits introducing it for the
> > usecase.
> >
> > OTOMH it was introduced for when you have hogs in drivers
> > doing all set-up of groups and functions from the device tree.
>
> Yeah, so in this case it is not necessary, but
> the comment above pinctrl_register() explicitly says:
> "To avoid issues later on, please use the
> new pinctrl_register_and_init() below instead."
> Which to me indicates that it is recommended
> to use the pinctrl_register_and_init() in future code...
>
> > Tony?
If you want to use GENERIC_PINCTRL_GROUPS or GENERIC_PINMUX_FUNCTIONS
want or allocate pins dynamically in the driver, then init needs to be
updated. So yeah I'd use that style init for any new code.
Regards,
Tony
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH -next v2] pinctrl: artpec6: Fix return value check in artpec6_pmx_probe()
2017-04-25 11:29 ` [PATCH -next v2] " Wei Yongjun
2017-04-25 13:40 ` Jesper Nilsson
@ 2017-04-28 7:41 ` Linus Walleij
1 sibling, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2017-04-28 7:41 UTC (permalink / raw)
To: Wei Yongjun
Cc: Jesper Nilsson, Lars Persson, Niklas Cassel, Wei Yongjun,
linux-arm-kernel, linux-gpio@vger.kernel.org
On Tue, Apr 25, 2017 at 1:29 PM, Wei Yongjun <weiyj.lk@gmail.com> 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>
> ---
> v1 -> v2: fix comment
Patch applied with Jesper's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-04-28 14:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).