Skip to contentSkip to conversation

arm: omap2: cm_common: Fix refcount balance bugs

PATCH New Liang He 1 participant 1 message Jul 1, 2022

Subsystems (3)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 arm: omap2: cm_common: Fix refcount balance bugs

In omap2_cm_base_init(), for_each_matching_node_and_match() will keep refcount balance. However, there is a reference escape into data->np, so we should use the of_node_put() for the old reference and of_node_get() for the new reference.

---
 arch/arm/mach-omap2/cm_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/cm_common.c +2 -1
index 87f2c2d2d754..9d5d92d00484 100644
@@ -339,7 +339,8 @@ int __init omap2_cm_base_init(void)
 			mem->offset = data->offset;
 		}
 
-		data->np = np;
+		of_node_put(data->np);
+		data->np = of_node_get(np);
 
 		if (data->init && (data->flags & CM_SINGLE_INSTANCE ||
 				   (cm_base.va && cm2_base.va)))
Signature · 1 line
2.25.1