summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/nuvoton
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2023-06-07 17:58:29 +0800
committerLinus Walleij <linus.walleij@linaro.org>2023-06-09 09:42:52 +0200
commitad64639417161e90b30dda00486570eb150aeee5 (patch)
tree92b42e0d42861256cdcf32b3d376d81bd5c54d3b /drivers/pinctrl/nuvoton
parent73f8ce7f961afcb3be49352efeb7c26cc1c00cc4 (diff)
pinctrl: npcm7xx: Add missing check for ioremap
Add check for ioremap() and return the error if it fails in order to guarantee the success of ioremap(). Fixes: 3b588e43ee5c ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230607095829.1345-1-jiasheng@iscas.ac.cn Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/nuvoton')
-rw-r--r--drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index 21e61c2a3798..843ffcd96877 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -1884,6 +1884,8 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl)
}
pctrl->gpio_bank[id].base = ioremap(res.start, resource_size(&res));
+ if (!pctrl->gpio_bank[id].base)
+ return -EINVAL;
ret = bgpio_init(&pctrl->gpio_bank[id].gc, dev, 4,
pctrl->gpio_bank[id].base + NPCM7XX_GP_N_DIN,