Skip to content

Commit 446d285

Browse files
Dan Carpenterlinusw
authored andcommitted
pinctrl: mediatek: common-v1: Fix error checking in mtk_eint_init()
The devm_kzalloc() function doesn't return error pointers, it returns NULL on error. Then on the next line it checks the same pointer again by mistake, "->base" instead of "->base[0]". Fixes: fe412e3 ("pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/aAijc10fHka1WAMX@stanley.mountain Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 34024cf commit 446d285

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/pinctrl/mediatek/pinctrl-mtk-common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,12 +1018,12 @@ static int mtk_eint_init(struct mtk_pinctrl *pctl, struct platform_device *pdev)
10181018
pctl->eint->nbase = 1;
10191019
/* mtk-eint expects an array */
10201020
pctl->eint->base = devm_kzalloc(pctl->dev, sizeof(pctl->eint->base), GFP_KERNEL);
1021-
if (IS_ERR(pctl->eint->base))
1021+
if (!pctl->eint->base)
10221022
return -ENOMEM;
10231023

10241024
pctl->eint->base[0] = devm_platform_ioremap_resource(pdev, 0);
1025-
if (IS_ERR(pctl->eint->base))
1026-
return PTR_ERR(pctl->eint->base);
1025+
if (IS_ERR(pctl->eint->base[0]))
1026+
return PTR_ERR(pctl->eint->base[0]);
10271027

10281028
pctl->eint->irq = irq_of_parse_and_map(np, 0);
10291029
if (!pctl->eint->irq)

0 commit comments

Comments
 (0)