[PATCH v7 4/4] gpio: mxc: fix race between gpiochip registration and IRQ domain setup

Linus Walleij linusw at kernel.org
Tue Oct 13 16:39:29 PDT 2026


On Tue, Oct 13, 2026 at 8:01 AM Peng Fan (OSS) <peng.fan at oss.nxp.com> wrote:

> From: Peng Fan <peng.fan at nxp.com>
>
> devm_gpiochip_add_data() makes the GPIO chip visible to consumers
> immediately. Since the chip sets .to_irq = mxc_gpio_to_irq, which calls
> irq_find_mapping(port->domain, offset), any to_irq() call between
> gpiochip registration and IRQ domain creation will operate on a NULL
> domain.
>
> Fix by moving devm_gpiochip_add_data() after the IRQ domain and generic
> irq chip are fully initialized, ensuring port->domain and the irq chip
> handlers are ready before the chip becomes visible to consumers.
>
> Fixes: d37a65bb4663 ("gpio/mxc: Move Freescale MXC gpio driver to drivers/gpio")
> Signed-off-by: Peng Fan <peng.fan at nxp.com>

Reviewed-by: Linus Walleij <linusw at kernel.org>

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list