* [PATCH] pinctrl: rza1: Remove unneeded wrong check for wrong variable
@ 2017-06-30 6:57 Geert Uytterhoeven
2017-06-30 13:47 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2017-06-30 6:57 UTC (permalink / raw)
To: Linus Walleij
Cc: Stephen Rothwell, Jacopo Mondi, Chris Brandt, linux-gpio,
linux-renesas-soc, linux-next, Geert Uytterhoeven
Depending on compiler version:
drivers/pinctrl/pinctrl-rza1.c: In function ‘rza1_pinctrl_probe’:
drivers/pinctrl/pinctrl-rza1.c:1260:5: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (ret)
^
Indeed, the result returned by platform_get_resource() was stored in
"res", not "ret". In addition, the correct error check would be
"if (!res)", as platform_get_resource() does not return an error code,
but returns NULL on failure.
However, as devm_ioremap_resource() verifies the validity of the passed
resource pointer anyway, the check can just be removed.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 5a49b644b3075f88 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
drivers/pinctrl/pinctrl-rza1.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c
index 614a043f3038d5d3..1188e6881e52ba7a 100644
--- a/drivers/pinctrl/pinctrl-rza1.c
+++ b/drivers/pinctrl/pinctrl-rza1.c
@@ -1257,9 +1257,6 @@ static int rza1_pinctrl_probe(struct platform_device *pdev)
rza1_pctl->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (ret)
- return -ENODEV;
-
rza1_pctl->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rza1_pctl->base))
return PTR_ERR(rza1_pctl->base);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: rza1: Remove unneeded wrong check for wrong variable
2017-06-30 6:57 [PATCH] pinctrl: rza1: Remove unneeded wrong check for wrong variable Geert Uytterhoeven
@ 2017-06-30 13:47 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2017-06-30 13:47 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Stephen Rothwell, Jacopo Mondi, Chris Brandt,
linux-gpio@vger.kernel.org, Linux-Renesas,
linux-next@vger.kernel.org
On Fri, Jun 30, 2017 at 8:57 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Depending on compiler version:
>
> drivers/pinctrl/pinctrl-rza1.c: In function ‘rza1_pinctrl_probe’:
> drivers/pinctrl/pinctrl-rza1.c:1260:5: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> if (ret)
> ^
>
> Indeed, the result returned by platform_get_resource() was stored in
> "res", not "ret". In addition, the correct error check would be
> "if (!res)", as platform_get_resource() does not return an error code,
> but returns NULL on failure.
>
> However, as devm_ioremap_resource() verifies the validity of the passed
> resource pointer anyway, the check can just be removed.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: 5a49b644b3075f88 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-30 13:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-30 6:57 [PATCH] pinctrl: rza1: Remove unneeded wrong check for wrong variable Geert Uytterhoeven
2017-06-30 13:47 ` 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).