Skip to contentSkip to conversation

ARM: milbeaut: Fix refcount leak in m10v_smp_init

PATCH In review Miaoqian Lin 2 participants 2 messages May 12, 2022 – May 13, 2022

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

PATCH 1/1 ARM: milbeaut: Fix refcount leak in m10v_smp_init

of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.

Fixes 9fb29c734f9e ("ARM: milbeaut: Add basic support for Milbeaut m10v SoC")
---
 arch/arm/mach-milbeaut/platsmp.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-milbeaut/platsmp.c +1 -0
index 3ea880f5fcb7..1f1ff21c7140 100644
@@ -53,6 +53,7 @@ static void m10v_smp_init(unsigned int max_cpus)
 		return;
 
 	m10v_smp_base = of_iomap(np, 0);
+	of_node_put(np);
 	if (!m10v_smp_base)
 		return;
 
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw

Thank you for the patch!

Quoted 23 lines · Miaoqian Lin

of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.

Fixes 9fb29c734f9e ("ARM: milbeaut: Add basic support for Milbeaut m10v SoC")
---
  arch/arm/mach-milbeaut/platsmp.c | 1 +
  1 file changed, 1 insertion(+)
arch/arm/mach-milbeaut/platsmp.c +1 -0
index 3ea880f5fcb7..1f1ff21c7140 100644
@@ -53,6 +53,7 @@ static void m10v_smp_init(unsigned int max_cpus)
  		return;
 
  	m10v_smp_base = of_iomap(np, 0);
+	of_node_put(np);
  	if (!m10v_smp_base)
  		return;