[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220607033306.688-2-linmq006@gmail.com>
Date: Tue, 7 Jun 2022 07:32:59 +0400
From: Miaoqian Lin <linmq006@...il.com>
To: "David S. Miller" <davem@...emloft.net>,
Miaoqian Lin <linmq006@...il.com>, sparclinux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/3] sparc: prom: Fix reference leak in of_console_init
of_find_node_by_path() returns a node pointer with
refcount incremented, we should use of_node_put() on it when not need
anymore.
Add missing of_node_put() to avoid refcount leak.
Fixes: c73fcc846c91 ("[SPARC]: Fix serial console device detection.")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
arch/sparc/kernel/prom_32.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c
index 3df960c137f7..7fc1c2dc31d5 100644
--- a/arch/sparc/kernel/prom_32.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -295,6 +295,7 @@ void __init of_console_init(void)
dp = of_find_node_by_path("/");
path = of_get_property(dp, "stdout-path", NULL);
+ of_node_put(dp);
if (!path) {
prom_printf("No stdout-path in root node.\n");
prom_halt();
--
2.25.1
Powered by blists - more mailing lists