[PATCH v2 24/27] mfd: mt6397: Manage IRQ domain lifecycle with devres

Chen-Yu Tsai wenst at chromium.org
Tue Oct 27 20:45:17 PDT 2026


On Tue, Oct 27, 2026 at 6:38 PM Lee Jones <lee at kernel.org> wrote:
>
> mt6397_irq_init() and mt6358_irq_init() create chip->irq_domain with
> irq_domain_create_linear() before registering the parent interrupt via
> devm_request_threaded_irq().  If devm_mfd_add_devices() fails in
> mt6397_probe(), irq_domain_remove() is called before devres frees the
> threaded IRQ and without disposing child IRQ mappings, allowing an
> in-flight interrupt handler or late IRQ lookup to dereference the
> removed domain.  Conversely, when the driver is unbound, the IRQ
> mappings and domain are never removed at all.
>
> Register a devres action immediately after irq_domain_create_linear() to
> dispose all mapped hardware interrupts and remove chip->irq_domain so
> that the domain is torn down after child MFD devices and the managed IRQ
> handler have been released on both probe failure and unbind.
>
> Fixes: 6df8dd5c185b ("mfd: Add support for the MediaTek MT6397 PMIC")
> Closes: https://sashiko.dev/#/bug/linux-b296fbe4-6e83-40c0-91c7-2c31e8d226d0
> Cc: stable at vger.kernel.org
> Signed-off-by: Lee Jones <lee at kernel.org>

Reviewed-by: Chen-Yu Tsai <wenst at chromium.org>



More information about the Linux-mediatek mailing list