All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe()
@ 2013-06-25  2:09 Wei Yongjun
  2013-06-25  2:59 ` Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wei Yongjun @ 2013-06-25  2:09 UTC (permalink / raw)
  To: thierry.reding, laurent.pinchart+renesas, axel.lin; +Cc: yongjun_wei, linux-pwm

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/pwm/pwm-renesas-tpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c
index 96e0cc4..70950e5 100644
--- a/drivers/pwm/pwm-renesas-tpu.c
+++ b/drivers/pwm/pwm-renesas-tpu.c
@@ -410,9 +410,9 @@ static int tpu_probe(struct platform_device *pdev)
 	}
 
 	tpu->base = devm_ioremap_resource(&pdev->dev, res);
-	if (tpu->base == NULL) {
+	if (IS_ERR(tpu->base)) {
 		dev_err(&pdev->dev, "failed to remap I/O memory\n");
-		return -ENXIO;
+		return PTR_ERR(tpu->base);
 	}
 
 	tpu->clk = devm_clk_get(&pdev->dev, NULL);

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

* Re: [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe()
  2013-06-25  2:09 [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe() Wei Yongjun
@ 2013-06-25  2:59 ` Axel Lin
  2013-06-25  8:59 ` Laurent Pinchart
  2013-06-25 10:21 ` Thierry Reding
  2 siblings, 0 replies; 5+ messages in thread
From: Axel Lin @ 2013-06-25  2:59 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: thierry.reding, laurent.pinchart+renesas, yongjun_wei, linux-pwm

2013/6/25 Wei Yongjun <weiyj.lk@gmail.com>:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---

Reviewed-by: Axel Lin <axel.lin@ingics.com>

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

* Re: [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe()
  2013-06-25  2:09 [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe() Wei Yongjun
  2013-06-25  2:59 ` Axel Lin
@ 2013-06-25  8:59 ` Laurent Pinchart
  2013-06-25 10:18   ` Thierry Reding
  2013-06-25 10:21 ` Thierry Reding
  2 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2013-06-25  8:59 UTC (permalink / raw)
  To: Wei Yongjun, axel.lin; +Cc: thierry.reding, yongjun_wei, linux-pwm

Hi Wei,

Thank you for the patch.

On Tuesday 25 June 2013 10:09:57 Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

With the change noted below,

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Thierry, do you need a v2, or can you fix the patch while applying ?

> ---
>  drivers/pwm/pwm-renesas-tpu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c
> index 96e0cc4..70950e5 100644
> --- a/drivers/pwm/pwm-renesas-tpu.c
> +++ b/drivers/pwm/pwm-renesas-tpu.c
> @@ -410,9 +410,9 @@ static int tpu_probe(struct platform_device *pdev)
>  	}
> 
>  	tpu->base = devm_ioremap_resource(&pdev->dev, res);
> -	if (tpu->base == NULL) {
> +	if (IS_ERR(tpu->base)) {
>  		dev_err(&pdev->dev, "failed to remap I/O memory\n");
> -		return -ENXIO;
> +		return PTR_ERR(tpu->base);
>  	}

You can remove the dev_err call well, devm_ioremap_resource() prints an error 
message already.

  	tpu->base = devm_ioremap_resource(&pdev->dev, res);
	if (IS_ERR(tpu->base))
		return PTR_ERR(tpu->base);

> 
>  	tpu->clk = devm_clk_get(&pdev->dev, NULL);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe()
  2013-06-25  8:59 ` Laurent Pinchart
@ 2013-06-25 10:18   ` Thierry Reding
  0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2013-06-25 10:18 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Wei Yongjun, axel.lin, yongjun_wei, linux-pwm

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

On Tue, Jun 25, 2013 at 10:59:49AM +0200, Laurent Pinchart wrote:
> Hi Wei,
> 
> Thank you for the patch.
> 
> On Tuesday 25 June 2013 10:09:57 Wei Yongjun wrote:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > 
> > In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> > and never returns NULL. The NULL test in the return value check should
> > be replaced with IS_ERR().
> > 
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> With the change noted below,
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Thierry, do you need a v2, or can you fix the patch while applying ?

No that's fine, I'll fix it up when applying. I should've noticed in the
first place anyway since I wrote devm_ioremap_resource() specifically so
that it never returns NULL and the error message wasn't required. =\

Thanks,
Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe()
  2013-06-25  2:09 [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe() Wei Yongjun
  2013-06-25  2:59 ` Axel Lin
  2013-06-25  8:59 ` Laurent Pinchart
@ 2013-06-25 10:21 ` Thierry Reding
  2 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2013-06-25 10:21 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: laurent.pinchart+renesas, axel.lin, yongjun_wei, linux-pwm

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

On Tue, Jun 25, 2013 at 10:09:57AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Applied with the change that Laurent squashed in. Thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-06-25 10:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-25  2:09 [PATCH -next] pwm: renesas-tpu: fix return value check in tpu_probe() Wei Yongjun
2013-06-25  2:59 ` Axel Lin
2013-06-25  8:59 ` Laurent Pinchart
2013-06-25 10:18   ` Thierry Reding
2013-06-25 10:21 ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.