All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: omap2: cm_common: Fix refcount balance bugs
@ 2022-07-01 11:50 Liang He
  0 siblings, 0 replies; only message in thread
From: Liang He @ 2022-07-01 11:50 UTC (permalink / raw)
  To: tony, linux, linux-omap, windhl

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.

Signed-off-by: Liang He <windhl@126.com>
---
 arch/arm/mach-omap2/cm_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 87f2c2d2d754..9d5d92d00484 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -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)))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-01 11:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 11:50 [PATCH] arm: omap2: cm_common: Fix refcount balance bugs Liang He

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.