[PATCH] misc: hi6421v600-irq: dispose the IRQ domain on remove and probe failure
From: Shirong Zhao
Date: Mon Nov 16 2026 - 23:13:39 EST
hi6421v600_irq_probe() creates a non-managed IRQ domain with
irq_domain_create_simple() and populates it with irq_create_mapping(),
but the driver has no .remove callback, so unbinding leaks the domain
and its mappings.
The same leak happens when irq_create_mapping() or
devm_request_threaded_irq() fails, because driver remove does not run
after a failed probe.
Share one disposal helper between a new remove callback and the probe
error path. The remaining resources are devm managed and are freed
automatically.
Fixes: bb3b6552a5b0 ("staging: hikey9xx: split hi6421v600 irq into a separate driver")
Signed-off-by: Shirong Zhao <shxzhaosr@xxxxxxx>
---
drivers/misc/hi6421v600-irq.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/hi6421v600-irq.c b/drivers/misc/hi6421v600-irq.c
index 7d2eb7e..e44141d 100644
--- a/drivers/misc/hi6421v600-irq.c
+++ b/drivers/misc/hi6421v600-irq.c
@@ -211,6 +211,17 @@ static void hi6421v600_irq_init(struct hi6421v600_irq *priv)
}
}
+static void hi6421v600_irq_dispose_domain(struct hi6421v600_irq *priv)
+{
+ int i;
+
+ for (i = 0; i < PMIC_IRQ_LIST_MAX; i++) {
+ if (priv->irqs[i])
+ irq_dispose_mapping(priv->irqs[i]);
+ }
+ irq_domain_remove(priv->domain);
+}
+
static int hi6421v600_irq_probe(struct platform_device *pdev)
{
struct device *pmic_dev = pdev->dev.parent;
@@ -264,7 +275,8 @@ static int hi6421v600_irq_probe(struct platform_device *pdev)
virq = irq_create_mapping(priv->domain, i);
if (!virq) {
dev_err(dev, "Failed to map H/W IRQ\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_dispose;
}
priv->irqs[i] = virq;
}
@@ -275,9 +287,18 @@ static int hi6421v600_irq_probe(struct platform_device *pdev)
IRQF_TRIGGER_LOW | IRQF_SHARED | IRQF_NO_SUSPEND,
"pmic", priv);
if (ret < 0)
- return ret;
+ goto err_dispose;
return 0;
+
+err_dispose:
+ hi6421v600_irq_dispose_domain(priv);
+ return ret;
+}
+
+static void hi6421v600_irq_remove(struct platform_device *pdev)
+{
+ hi6421v600_irq_dispose_domain(platform_get_drvdata(pdev));
}
static const struct platform_device_id hi6421v600_irq_table[] = {
@@ -292,6 +313,7 @@ static struct platform_driver hi6421v600_irq_driver = {
.name = "hi6421v600-irq",
},
.probe = hi6421v600_irq_probe,
+ .remove = hi6421v600_irq_remove,
};
module_platform_driver(hi6421v600_irq_driver);