Skip to contentSkip to conversation

ARM: versatile: Fix refcount leak in ap_init_of

PATCH In review Miaoqian Lin 2 participants 2 messages Jun 5, 2022 – Jun 15, 2022

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

PATCH 1/1 ARM: versatile: Fix refcount leak in ap_init_of

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

Fixes e67ae6be734d ("ARM: integrator: hook the AP into the SoC bus")
Fixes df36680f1a71 ("ARM: integrator: core module registers from compatible strings")
---
 arch/arm/mach-versatile/integrator_ap.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-versatile/integrator_ap.c +1 -0
index e216fac917d0..6b2a69acc6b0 100644
@@ -175,6 +175,7 @@ static void __init ap_init_of(void)
 	if (!syscon)
 		return;
 	ap_syscon_map = syscon_node_to_regmap(syscon);
+	of_node_put(syscon);
 	if (IS_ERR(ap_syscon_map)) {
 		pr_crit("could not find Integrator/AP system controller\n");
 		return;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 7 lines · Miaoqian Lin

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

Fixes e67ae6be734d ("ARM: integrator: hook the AP into the SoC bus")
Fixes df36680f1a71 ("ARM: integrator: core module registers from compatible strings")

Patch applied!

Yours,
Linus Walleij