[PATCH] pinctrl: mediatek: common-v2: Fix of_iomap() error check
Linus Walleij
linusw at kernel.org
Wed Nov 4 04:26:50 PST 2026
On Mon, Oct 5, 2026 at 8:06 AM Saad Anjum <saadanjum239 at gmail.com> wrote:
> of_iomap() returns NULL on failure, never an error pointer, so the
> IS_ERR() check in mtk_build_eint() can never be true. The check was
> carried over from the previous devm_platform_ioremap_resource_byname()
> call, which does return an error pointer, when the EINT registers were
> switched to being mapped with of_iomap() to support multiple bases.
>
> If mapping one of the EINT register ranges fails, for example because
> the device tree node lists more "reg-names" than "reg" entries so that
> of_address_to_resource() fails, or because ioremap() itself fails, the
> NULL pointer is stored in hw->eint->base[] and probing continues.
> mtk_eint_do_init() then calls mtk_eint_hw_init(), which writes to
> eint->base[i] + regs->dom_en, causing a NULL pointer dereference
> instead of a clean probe failure.
>
> Check for NULL and return -ENOMEM instead. The existing error path
> already skips NULL entries when unmapping, so any ranges mapped before
> the failure are still released.
>
> Fixes: 3ef9f710efcb ("pinctrl: mediatek: Add EINT support for multiple addresses")
> Signed-off-by: Saad Anjum <saadanjum239 at gmail.com>
Patch applied.
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list