[PATCH 3/6] mfd: palmas: Fix potential IRQ action leaks on removal
From: Guangshuo Li
Date: Fri Oct 30 2026 - 12:57:55 EST
The remove callback deletes the IRQ chip before managed OF children
are removed. Their later free_irq() calls cannot find the disposed IRQ
descriptors, potentially leaking interrupt actions. Depopulate the
children before deleting the IRQ chip and auxiliary I2C clients.
This issue was found by our static analysis tool under development.
Fixes: 124e9deb1c40 ("mfd: palmas: Use devm_of_platform_populate()")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: OpenAI:gpt-6-astra
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
Build-tested the changed object with x86_64 defconfig plus COMPILE_TEST
and the driver dependencies (W=1).
No runtime or fault-injection testing was performed.
drivers/mfd/palmas.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 7fc886f4f80e..8a0b7b1e89d7 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -677,6 +677,9 @@ static void palmas_i2c_remove(struct i2c_client *i2c)
struct palmas *palmas = i2c_get_clientdata(i2c);
int i;
+ if (i2c->dev.of_node)
+ devm_of_platform_depopulate(&i2c->dev);
+
regmap_del_irq_chip(palmas->irq, palmas->irq_data);
for (i = 1; i < PALMAS_NUM_CLIENTS; i++) {