Skip to contentSkip to conversation

pinctrl: stm32: Fix refcount leak in stm32_pctrl_get_irq_domain

PATCH In review Miaoqian Lin 2 participants 2 messages Jan 2, 2023 – Jan 9, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: stm32: Fix refcount leak in stm32_pctrl_get_irq_domain

of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.

Fixes d86f4d71e42a ("pinctrl: stm32: check irq controller availability at probe")
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -0
index 1cddca506ad7..cb33a23ab0c1 100644
@@ -1382,6 +1382,7 @@ static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pde
 		return ERR_PTR(-ENXIO);
 
 	domain = irq_find_host(parent);
+	of_node_put(parent);
 	if (!domain)
 		/* domain not registered yet */
 		return ERR_PTR(-EPROBE_DEFER);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Miaoqian Lin

of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.

Fixes d86f4d71e42a ("pinctrl: stm32: check irq controller availability at probe")

Patch applied!

Yours,
Linus Walleij