* [PATCH] ARM: hisi: Fix refcount leak in hip04_smp_init
@ 2022-05-12 8:10 Miaoqian Lin
0 siblings, 0 replies; only message in thread
From: Miaoqian Lin @ 2022-05-12 8:10 UTC (permalink / raw)
To: Wei Xu, Russell King, Haojian Zhuang, Nicolas Pitre,
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: 9cdc99919a95 ("ARM: hisi: enable MCPM implementation")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
arch/arm/mach-hisi/platmcpm.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c
index 258586e31333..e9b5d63ecf4c 100644
--- a/arch/arm/mach-hisi/platmcpm.c
+++ b/arch/arm/mach-hisi/platmcpm.c
@@ -274,6 +274,7 @@ static int __init hip04_smp_init(void)
goto err;
ret = of_property_read_u32_array(np, "boot-method",
&hip04_boot_method[0], 4);
+ of_node_put(np);
if (ret)
goto err;
@@ -283,11 +284,11 @@ static int __init hip04_smp_init(void)
goto err;
np_fab = of_find_compatible_node(NULL, NULL, "hisilicon,hip04-fabric");
if (!np_fab)
- goto err;
+ goto err_put_sctl;
ret = memblock_reserve(hip04_boot_method[0], hip04_boot_method[1]);
if (ret)
- goto err;
+ goto err_put_fab;
relocation = ioremap(hip04_boot_method[2], hip04_boot_method[3]);
if (!relocation) {
@@ -329,6 +330,8 @@ static int __init hip04_smp_init(void)
writel_relaxed(__pa_symbol(secondary_startup), relocation + 8);
writel_relaxed(0, relocation + 12);
iounmap(relocation);
+ of_node_put(np_fab);
+ of_node_put(np_sctl);
smp_set_ops(&hip04_smp_ops);
return ret;
@@ -340,6 +343,10 @@ static int __init hip04_smp_init(void)
iounmap(relocation);
err_reloc:
memblock_phys_free(hip04_boot_method[0], hip04_boot_method[1]);
+err_put_fab:
+ of_node_put(np_fab);
+err_put_sctl:
+ of_node_put(np_sctl);
err:
return ret;
}
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-12 8:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 8:10 [PATCH] ARM: hisi: Fix refcount leak in hip04_smp_init Miaoqian Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®