Re: [PATCH] gpio: mvebu: fix devres LIFO ordering between GPIO chip and IRQ domain

From: Bartosz Golaszewski

Date: Mon Jul 06 2026 - 05:54:45 EST


On Fri, 3 Jul 2026 01:18:38 +0200, Rosen Penev <rosenp@xxxxxxxxx> said:
> During driver removal, devres cleans up in LIFO order. The IRQ domain
> was created and its devm cleanup action registered after
> devm_gpiochip_add_data(), so the domain was destroyed before the GPIO
> chip was deregistered. If gpiod_to_irq() is called on a pin during
> this window, mvebu_gpio_to_irq() passes the freed mvchip->domain to
> irq_create_mapping().
>
> Fix by moving the IRQ domain creation, devm cleanup action registration,
> generic chip allocation, and chip type setup before
> devm_gpiochip_add_data(). This ensures the GPIO chip is torn down
> first (preventing new IRQ mappings), then the IRQ domain is removed,
> and finally mvchip is freed.
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---

Can you resend with the Fixes tag?

Bart