Skip to content

Commit 283fb4e

Browse files
Jialin Zhanglinusw
authored andcommitted
pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
In case of error, the function devm_platform_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: a1d1e0e ("pinctrl: nuvoton: Add driver for WPCM450") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Jialin Zhang <[email protected]> Reviewed-by: Jonathan Neuschäfer <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent ce2076b commit 283fb4e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/pinctrl/nuvoton/pinctrl-wpcm450.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
10191019
int ret;
10201020

10211021
pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
1022-
if (!pctrl->gpio_base)
1023-
return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
1022+
if (IS_ERR(pctrl->gpio_base))
1023+
return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
1024+
"Resource fail for GPIO controller\n");
10241025

10251026
device_for_each_child_node(dev, child) {
10261027
void __iomem *dat = NULL;

0 commit comments

Comments
 (0)