]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pinctrl: mediatek: common-v1: Fix error checking in mtk_eint_init()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 23 Apr 2025 08:23:15 +0000 (11:23 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 23 Apr 2025 10:58:57 +0000 (12:58 +0200)
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: fe412e3a6c97 ("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>
drivers/pinctrl/mediatek/pinctrl-mtk-common.c

index 7585de11854becaca733efeafc2ce3164b1aa1ce..8596f3541265e9b0fa78a7dd7aeef028c9d9b6fc 100644 (file)
@@ -1018,12 +1018,12 @@ static int mtk_eint_init(struct mtk_pinctrl *pctl, struct platform_device *pdev)
        pctl->eint->nbase = 1;
        /* mtk-eint expects an array */
        pctl->eint->base = devm_kzalloc(pctl->dev, sizeof(pctl->eint->base), GFP_KERNEL);
-       if (IS_ERR(pctl->eint->base))
+       if (!pctl->eint->base)
                return -ENOMEM;
 
        pctl->eint->base[0] = devm_platform_ioremap_resource(pdev, 0);
-       if (IS_ERR(pctl->eint->base))
-               return PTR_ERR(pctl->eint->base);
+       if (IS_ERR(pctl->eint->base[0]))
+               return PTR_ERR(pctl->eint->base[0]);
 
        pctl->eint->irq = irq_of_parse_and_map(np, 0);
        if (!pctl->eint->irq)