Skip to contentSkip to conversation

arm: mach-omap2: omap4-common: Fix refcount leak bug

PATCH Superseded Liang He 2 participants 2 messages Jun 28, 2022 – Jul 4, 2022

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH v3 1/1 arm: mach-omap2: omap4-common: Fix refcount leak bug

In omap4_sram_init(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.

---
changelog:

v3: change the order of of_node_put() based on tony's advice
v2: merge similar bugs in omap2 into one commit
v1: fix missing of_node_put() bugs

 arch/arm/mach-omap2/omap4-common.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/omap4-common.c +1 -0
index 6d1eb4eefefe..d9ed2a5dcd5e 100644
@@ -140,6 +140,7 @@ static int __init omap4_sram_init(void)
 			__func__);
 	else
 		sram_sync = (void __iomem *)gen_pool_alloc(sram_pool, PAGE_SIZE);
+	of_node_put(np);
 
 	return 0;
 }
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 3 lines · Liang He

In omap4_sram_init(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.

Thanks applying into omap-for-v5.20/soc.

Tony