linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR
@ 2020-01-09  7:27 Gustavo A. R. Silva
  2020-01-09  7:44 ` Uwe Kleine-König
  2020-01-10  7:18 ` Uwe Kleine-König
  0 siblings, 2 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2020-01-09  7:27 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Maxime Ripard,
	Chen-Yu Tsai, Clément Péron, Jernej Skrabec
  Cc: linux-pwm, linux-arm-kernel, linux-kernel, Gustavo A. R. Silva

Fix inconsistent IS_ERR and PTR_ERR in sun4i_pwm_probe().

The proper pointers to be passed as arguments are pwm->clk and pwm->bus_clk.

This bug was detected with the help of Coccinelle.

Fixes: b8d74644f34a ("pwm: sun4i: Prefer "mod" clock to unnamed")
Fixes: 5b090b430d75 ("pwm: sun4i: Add an optional probe for bus clock")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/pwm/pwm-sun4i.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 1afd41ebd3fd..a805c347ee84 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -423,7 +423,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
 	 */
 	pwm->clk = devm_clk_get_optional(&pdev->dev, "mod");
 	if (IS_ERR(pwm->clk)) {
-		if (PTR_ERR(pwm->rst) != -EPROBE_DEFER)
+		if (PTR_ERR(pwm->clk) != -EPROBE_DEFER)
 			dev_err(&pdev->dev, "get mod clock failed %pe\n",
 				pwm->clk);
 		return PTR_ERR(pwm->clk);
@@ -432,7 +432,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
 	if (!pwm->clk) {
 		pwm->clk = devm_clk_get(&pdev->dev, NULL);
 		if (IS_ERR(pwm->clk)) {
-			if (PTR_ERR(pwm->rst) != -EPROBE_DEFER)
+			if (PTR_ERR(pwm->clk) != -EPROBE_DEFER)
 				dev_err(&pdev->dev, "get unnamed clock failed %pe\n",
 					pwm->clk);
 			return PTR_ERR(pwm->clk);
@@ -441,7 +441,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
 
 	pwm->bus_clk = devm_clk_get_optional(&pdev->dev, "bus");
 	if (IS_ERR(pwm->bus_clk)) {
-		if (PTR_ERR(pwm->rst) != -EPROBE_DEFER)
+		if (PTR_ERR(pwm->bus_clk) != -EPROBE_DEFER)
 			dev_err(&pdev->dev, "get bus clock failed %pe\n",
 				pwm->bus_clk);
 		return PTR_ERR(pwm->bus_clk);
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR
  2020-01-09  7:27 [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR Gustavo A. R. Silva
@ 2020-01-09  7:44 ` Uwe Kleine-König
  2020-01-09  9:14   ` Clément Péron
  2020-01-10  7:18 ` Uwe Kleine-König
  1 sibling, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2020-01-09  7:44 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Thierry Reding, Maxime Ripard, Chen-Yu Tsai,
	Clément Péron, Jernej Skrabec, linux-pwm, linux-kernel,
	linux-arm-kernel

Hello Gustavo,

On Thu, Jan 09, 2020 at 01:27:35AM -0600, Gustavo A. R. Silva wrote:
> Fix inconsistent IS_ERR and PTR_ERR in sun4i_pwm_probe().
> 
> The proper pointers to be passed as arguments are pwm->clk and pwm->bus_clk.
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: b8d74644f34a ("pwm: sun4i: Prefer "mod" clock to unnamed")
> Fixes: 5b090b430d75 ("pwm: sun4i: Add an optional probe for bus clock")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/pwm/pwm-sun4i.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index 1afd41ebd3fd..a805c347ee84 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -423,7 +423,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
>  	 */
>  	pwm->clk = devm_clk_get_optional(&pdev->dev, "mod");
>  	if (IS_ERR(pwm->clk)) {
> -		if (PTR_ERR(pwm->rst) != -EPROBE_DEFER)
> +		if (PTR_ERR(pwm->clk) != -EPROBE_DEFER)

How embarrassing that I didn't notice these. Thanks for catching.

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR
  2020-01-09  7:44 ` Uwe Kleine-König
@ 2020-01-09  9:14   ` Clément Péron
  2020-01-09 13:18     ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Clément Péron @ 2020-01-09  9:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Gustavo A. R. Silva, Thierry Reding, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Linux PWM List, linux-kernel, linux-arm-kernel

Hi Uwe, Gustavo,

On Thu, 9 Jan 2020 at 08:44, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Hello Gustavo,
>
> On Thu, Jan 09, 2020 at 01:27:35AM -0600, Gustavo A. R. Silva wrote:
> > Fix inconsistent IS_ERR and PTR_ERR in sun4i_pwm_probe().
> >
> > The proper pointers to be passed as arguments are pwm->clk and pwm->bus_clk.

Thanks for the catch.

As these patches are still in next should we update them or apply a fix ?

Regards,
Clement

> >
> > This bug was detected with the help of Coccinelle.
> >
> > Fixes: b8d74644f34a ("pwm: sun4i: Prefer "mod" clock to unnamed")
> > Fixes: 5b090b430d75 ("pwm: sun4i: Add an optional probe for bus clock")
> > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> > ---
> >  drivers/pwm/pwm-sun4i.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> > index 1afd41ebd3fd..a805c347ee84 100644
> > --- a/drivers/pwm/pwm-sun4i.c
> > +++ b/drivers/pwm/pwm-sun4i.c
> > @@ -423,7 +423,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
> >        */
> >       pwm->clk = devm_clk_get_optional(&pdev->dev, "mod");
> >       if (IS_ERR(pwm->clk)) {
> > -             if (PTR_ERR(pwm->rst) != -EPROBE_DEFER)
> > +             if (PTR_ERR(pwm->clk) != -EPROBE_DEFER)
>
> How embarrassing that I didn't notice these. Thanks for catching.
>
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | https://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR
  2020-01-09  9:14   ` Clément Péron
@ 2020-01-09 13:18     ` Uwe Kleine-König
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2020-01-09 13:18 UTC (permalink / raw)
  To: Clément Péron, Thierry Reding
  Cc: Gustavo A. R. Silva, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
	Linux PWM List, linux-kernel, linux-arm-kernel

Hello,

On Thu, Jan 09, 2020 at 10:14:00AM +0100, Clément Péron wrote:
> On Thu, 9 Jan 2020 at 08:44, Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > Hello Gustavo,
> >
> > On Thu, Jan 09, 2020 at 01:27:35AM -0600, Gustavo A. R. Silva wrote:
> > > Fix inconsistent IS_ERR and PTR_ERR in sun4i_pwm_probe().
> > >
> > > The proper pointers to be passed as arguments are pwm->clk and pwm->bus_clk.
> 
> Thanks for the catch.
> 
> As these patches are still in next should we update them or apply a fix ?

That's for Thierry to answer.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR
  2020-01-09  7:27 [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR Gustavo A. R. Silva
  2020-01-09  7:44 ` Uwe Kleine-König
@ 2020-01-10  7:18 ` Uwe Kleine-König
  1 sibling, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2020-01-10  7:18 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Thierry Reding, Maxime Ripard, Chen-Yu Tsai,
	Clément Péron, Jernej Skrabec, linux-pwm,
	linux-arm-kernel, linux-kernel

Hello,

On Thu, Jan 09, 2020 at 01:27:35AM -0600, Gustavo A. R. Silva wrote:
> Fix inconsistent IS_ERR and PTR_ERR in sun4i_pwm_probe().
> 
> The proper pointers to be passed as arguments are pwm->clk and pwm->bus_clk.
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: b8d74644f34a ("pwm: sun4i: Prefer "mod" clock to unnamed")
> Fixes: 5b090b430d75 ("pwm: sun4i: Add an optional probe for bus clock")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Patchwork seems to have missed my earlier reply with my Reviewed-by:.
(https://patchwork.ozlabs.org/patch/1220206/ only has Clément's reply
that still contains my quoted text, but obviously this wasn't picked up
by patchwork.)

So resending it in the hope this was a one-time miss:

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-10  7:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  7:27 [PATCH] pwm: sun4i: Fix inconsistent IS_ERR and PTR_ERR Gustavo A. R. Silva
2020-01-09  7:44 ` Uwe Kleine-König
2020-01-09  9:14   ` Clément Péron
2020-01-09 13:18     ` Uwe Kleine-König
2020-01-10  7:18 ` Uwe Kleine-König

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).