linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] arm: mach-rockchip: (pm) Add missing of_node_put()
@ 2022-06-16  2:17 Liang He
  2022-06-17 17:10 ` Heiko Stuebner
  2022-06-22  9:00 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 5+ messages in thread
From: Liang He @ 2022-06-16  2:17 UTC (permalink / raw)
  To: linux, heiko; +Cc: linux-arm-kernel, linux-rockchip, linux-kernel, windhl

In rockchip_suspend_init(), of_find_matching_node_and_match() will
return a node pointer with refcount incremented. We should use
of_node_put() in fail path or when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 changelog:

 v2: (1) use real name for Sob (2) use goto-label patch style
 v1: add of_node_put() for each return

 arch/arm/mach-rockchip/pm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c
index 87389d9456b9..bb46ac4f65d4 100644
--- a/arch/arm/mach-rockchip/pm.c
+++ b/arch/arm/mach-rockchip/pm.c
@@ -311,7 +311,7 @@ void __init rockchip_suspend_init(void)
 					     &match);
 	if (!match) {
 		pr_err("Failed to find PMU node\n");
-		return;
+		goto out_put;
 	}
 	pm_data = (struct rockchip_pm_data *) match->data;
 
@@ -320,9 +320,13 @@ void __init rockchip_suspend_init(void)
 
 		if (ret) {
 			pr_err("%s: matches init error %d\n", __func__, ret);
-			return;
+			goto out_put;
 		}
 	}
 
 	suspend_set_ops(pm_data->ops);
+	
+out_put:
+	of_node_put(np);
+	
 }
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-22 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-16  2:17 [PATCH v2] arm: mach-rockchip: (pm) Add missing of_node_put() Liang He
2022-06-17 17:10 ` Heiko Stuebner
2022-06-18  2:43   ` Liang He
2022-06-22  9:00 ` Krzysztof Kozlowski
2022-06-22 13:10   ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).