pinctrl: rza1: fix incorrect failure check on platform_get_resources
diff mbox

Message ID 20170630103355.9769-1-colin.king@canonical.com
State New
Headers show

Commit Message

Colin King June 30, 2017, 10:33 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The return res from platform_get_resources should be checked for
a failure rather than ret.  Fixes warning:

'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]

Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pinctrl/pinctrl-rza1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij June 30, 2017, 1:50 p.m. UTC | #1
On Fri, Jun 30, 2017 at 12:33 PM, Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
>
> The return res from platform_get_resources should be checked for
> a failure rather than ret.  Fixes warning:
>
> 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Geert already sent the right fix for this.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c
index 29ddd624fb98..e79c8b9818d7 100644
--- a/drivers/pinctrl/pinctrl-rza1.c
+++ b/drivers/pinctrl/pinctrl-rza1.c
@@ -1257,7 +1257,7 @@  static int rza1_pinctrl_probe(struct platform_device *pdev)
 	rza1_pctl->dev = &pdev->dev;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (ret)
+	if (!res)
 		return -ENODEV;
 
 	rza1_pctl->base = devm_ioremap_resource(&pdev->dev, res);