Skip to contentSkip to conversation

ARM: OMAP2+: Fix refcount leak in omap_gic_of_init

PATCH New Miaoqian Lin 1 participant 1 message Mar 9, 2022

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

PATCH 1/1 ARM: OMAP2+: Fix refcount leak in omap_gic_of_init

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Fixes fd1c07861491 ("ARM: OMAP4: Fix the init code to have OMAP4460 errata available in DT build")
---
 arch/arm/mach-omap2/omap4-common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-omap2/omap4-common.c +2 -0
index 5c3845730dbf..0b80f8bcd304 100644
@@ -314,10 +314,12 @@ void __init omap_gic_of_init(void)
 
 	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic");
 	gic_dist_base_addr = of_iomap(np, 0);
+	of_node_put(np);
 	WARN_ON(!gic_dist_base_addr);
 
 	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-twd-timer");
 	twd_base = of_iomap(np, 0);
+	of_node_put(np);
 	WARN_ON(!twd_base);
 
 skip_errata_init:
Signature · 1 line
2.17.1