Thread (11 messages) 11 messages, 6 authors, 2017-03-15

[PATCH -next] pinctrl: samsung: Fix return value check in samsung_pinctrl_get_soc_data()

From: Tomasz Figa <hidden>
Date: 2017-01-25 14:25:45
Also in: linux-gpio, linux-samsung-soc

Hi Wei,

2017-01-25 23:03 GMT+09:00 Wei Yongjun [off-list ref]:
quoted hunk ↗ jump to hunk
From: Wei Yongjun <redacted>

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

Fixes: 8b1bd11c1f8f ("pinctrl: samsung: Add the support the multiple
IORESOURCE_MEM for one pin-bank")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 3bc925f..9c03eab 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -1009,7 +1009,7 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
                res = platform_get_resource(pdev, IORESOURCE_MEM, i);
                virt_base[i] = devm_ioremap(&pdev->dev, res->start,
                                                resource_size(res));
-               if (IS_ERR(virt_base[i]))
+               if (!virt_base[i])
I'd rather replace devm_ioremap() (and explicit resource struct
dereferencing, without any checks by the way), with
devm_ioremap_resource() (which actually returns ERR_PTR()s, so no need
to change the condition with it).

Best regards,
Tomasz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help