[PATCH 03/10] gpio: mvebu: Clear chained IRQ handlers on unbind
From: Lee Jones
Date: Thu Dec 03 2026 - 15:56:57 EST
mvebu_gpio_probe() installs chained IRQ handlers pointing to the
devm-allocated mvchip structure, but neither sets suppress_bind_attrs
nor removes the chained handlers on unbind. Unbinding the device tears
down mvchip->domain and frees mvchip while mvebu_gpio_irq_handler()
remains registered.
Register a devm cleanup action after installing the chained handlers to
clear each bank IRQ handler before the IRQ domain, GPIO chip, and
mvchip are torn down.
Fixes: fefe7b092345 ("gpio: introduce gpio-mvebu driver for Marvell SoCs")
Closes: https://sashiko.dev/#/bug/linux-de993bd0-1753-40e6-bd77-aa0fb133120b
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/gpio/gpio-mvebu.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 6c2bcc5d749c..2f0a6cecd52a 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1181,6 +1181,17 @@ static void mvebu_gpio_remove_irq_domain(void *data)
irq_domain_remove(domain);
}
+static void mvebu_gpio_remove_chained_handlers(void *data)
+{
+ struct mvebu_gpio_chip *mvchip = data;
+
+ for (unsigned int i = 0; i < ARRAY_SIZE(mvchip->bank_irq); i++) {
+ if (mvchip->bank_irq[i] > 0)
+ irq_set_chained_handler_and_data(mvchip->bank_irq[i],
+ NULL, NULL);
+ }
+}
+
static int mvebu_gpio_probe(struct platform_device *pdev)
{
struct mvebu_gpio_chip *mvchip;
@@ -1370,7 +1381,9 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->bank_irq[i] = irq;
}
- return 0;
+ return devm_add_action_or_reset(&pdev->dev,
+ mvebu_gpio_remove_chained_handlers,
+ mvchip);
}
static struct platform_driver mvebu_gpio_driver = {
--
2.56.1.911.g883d8bcb20-goog