[PATCH v4 0/3] mfd: tps65217: Handle IRQ initialization errors
From: Жамбакиев Радий Рикардинович
Date: Thu Sep 17 2026 - 06:42:05 EST
From: Radiy Zhambakiev <r.zhambakiev@xxxxxxxxxxxxxxxxx>
The TPS65217 MFD driver does not validate the outcome of IRQ
initialisation: tps65217_probe() ignores the return value of
tps65217_irq_init(), so a failed irq_domain creation leaves the
driver bound with a NULL tps->irq_domain and the remove callback
oopses, and a failed write of the interrupt mask leaves the software
mask out of sync with the hardware.
On top of that the irq_domain is torn down in the wrong order: the
remove callback disposes the mappings and removes the domain before
the MFD children are unbound, so children that requested interrupts
(e.g. tps65217-charger) release virtual IRQs whose descriptors are
already disposed, and on probe failure the domain is leaked with its
host_data pointing to freed memory. The enable_irq_wake() in probe
is never balanced.
This series plugs the probe error paths and moves the domain and
wake-up teardown into devres, registered right after the domain is
created. Devres actions are released in reverse order of
registration, so on both removal and probe failure the MFD children
release their IRQs first, then the parent interrupt is freed and its
thread stopped, and only then is the domain removed.
Changes since v3:
- No functional changes; applied the code-style fixes requested by
Lee Jones.
Link: https://lore.kernel.org/all/20260904063439.69881-1-r.zhambakiev@xxxxxxxxxxxxxxxxx/
Radiy Zhambakiev (3):
mfd: tps65217: Fix NULL pointer dereference on IRQ init failure
mfd: tps65217: Check return value when masking interrupt sources
mfd: tps65217: Use devres for IRQ domain and wake teardown
drivers/mfd/tps65217.c | 70 +++++++++++++++++++++++++++++-------------
1 file changed, 49 insertions(+), 21 deletions(-)
--
2.53.0