Commit 283fb4ea authored by Jialin Zhang's avatar Jialin Zhang Committed by Linus Walleij

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: a1d1e0e3 ("pinctrl: nuvoton: Add driver for WPCM450")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: default avatarJonathan Neuschäfer <j.neuschaefer@gmx.net>
Link: https://lore.kernel.org/r/20220317065851.495394-1-zhangjialin11@huawei.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ce2076ba
......@@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
int ret;
pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
if (!pctrl->gpio_base)
return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
if (IS_ERR(pctrl->gpio_base))
return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
"Resource fail for GPIO controller\n");
device_for_each_child_node(dev, child) {
void __iomem *dat = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment