linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
@ 2022-05-12  2:58 Miaoqian Lin
  2022-05-12  3:06 ` Wei Xu
  2022-05-12  3:09 ` Wei Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-05-12  2:58 UTC (permalink / raw)
  To: Wei Xu, Russell King, Kevin Hilman, Haojian Zhuang, Zhangfei Gao,
	linux-arm-kernel, linux-kernel
  Cc: linmq006

of_find_compatible_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: a9434e96d9f0 ("ARM: hi3xxx: add smp support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/arm/mach-hisi/platsmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
index a56cc64deeb8..15e63b72df3a 100644
--- a/arch/arm/mach-hisi/platsmp.c
+++ b/arch/arm/mach-hisi/platsmp.c
@@ -68,13 +68,16 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
 		ctrl_base = of_iomap(np, 0);
 		if (!ctrl_base) {
 			pr_err("failed to map address\n");
+			of_node_put(np);
 			return;
 		}
 		if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
 			pr_err("failed to find smp-offset property\n");
+			of_node_put(np);
 			return;
 		}
 		ctrl_base += offset;
+		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] 3+ messages in thread

end of thread, other threads:[~2022-05-12  3:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-12  2:58 [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus Miaoqian Lin
2022-05-12  3:06 ` Wei Xu
2022-05-12  3:09 ` Wei Xu

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).