ARM: hisi: Fix refcount leak in hip04_smp_init
Subsystems (3)
PATCH 1/1 ARM: hisi: Fix refcount leak in hip04_smp_init
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 <[email protected]>
--- arch/arm/mach-hisi/platmcpm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-hisi/platmcpm.c +9 -2
@@ -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; }
Signature · 1 line
2.25.1