[PATCH v4 2/5] of/irq: Fix OF node refcount in of_msi_get_domain()

Lorenzo Pieralisi lpieralisi at kernel.org
Tue Oct 21 05:41:00 PDT 2025


In of_msi_get_domain() if the iterator loop stops early because an
irq_domain match is detected, an of_node_put() on the iterator node is
needed to keep the OF node refcount in sync.

Add it.

Signed-off-by: Lorenzo Pieralisi <lpieralisi at kernel.org>
Reviewed-by: Frank Li <Frank.Li at nxp.com>
Cc: Rob Herring <robh at kernel.org>
---
 drivers/of/irq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 321d40ec229b..ee7d5f0842e8 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -774,8 +774,10 @@ struct irq_domain *of_msi_get_domain(struct device *dev,
 
 	of_for_each_phandle(&it, err, np, "msi-parent", "#msi-cells", 0) {
 		d = irq_find_matching_host(it.node, token);
-		if (d)
+		if (d) {
+			of_node_put(it.node);
 			return d;
+		}
 	}
 
 	return NULL;
-- 
2.50.1




More information about the linux-arm-kernel mailing list