diff options
author | Jialin Zhang <zhangjialin11@huawei.com> | 2022-03-17 09:58:51 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2022-03-24 22:10:32 +0300 |
commit | 283fb4ea08c5876150b4158e9c20c14309214ce2 (patch) | |
tree | ea8a1712dfe48653b4adffec8fb7045fcb2eeece /drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | |
parent | ce2076ba209e5e5258b71c44065988d8f7fa2976 (diff) | |
download | linux-283fb4ea08c5876150b4158e9c20c14309214ce2.tar.xz |
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: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Link: https://lore.kernel.org/r/20220317065851.495394-1-zhangjialin11@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/nuvoton/pinctrl-wpcm450.c')
-rw-r--r-- | drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c index f7565ce66651..0dbeb91f0bf2 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c @@ -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; |