ARM: mstar: Fix refcount leaks
PATCH 1/1 ARM: mstar: Fix refcount leaks
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 5919eec0f092 ("ARM: mstar: SMP support")
Fixes 312b62b6610c ("ARM: mstar: Add machine for MStar/Sigmastar Armv7 SoCs")
Signed-off-by Miaoqian Lin <[email protected]>
--- arch/arm/mach-mstar/mstarv7.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-mstar/mstarv7.c +2 -0
@@ -86,6 +86,7 @@ static int mstarv7_boot_secondary(unsigned int cpu, struct task_struct *idle) np =of_find_compatible_node (NULL ,NULL ,"mstar,smpctrl" ); smpctrl =of_iomap (np,0 ); +of_node_put (np);if (!smpctrl)return -ENODEV ;
@@ -120,6 +121,7 @@ static void __init mstarv7_init(void) soc_mb = mstarv7_mb; else pr_warn("Failed to install memory barrier, DMA will be broken!\n"); +of_node_put (np); }DT_MACHINE_START (MSTARV7_DT ,"MStar/Sigmastar Armv7 (Device Tree)" )
Signature · 1 line
2.25.1
Hi,
Quoted 8 lines · Miaoqian Lin
of_find_compatible_node()returns a node pointer with refcount incremented, we should useof_node_put()on it when done. Add missingof_node_put()to avoid refcount leak.Fixes 5919eec0f092 ("ARM: mstar: SMP support")Fixes 312b62b6610c ("ARM: mstar: Add machine for MStar/Sigmastar Armv7 SoCs")Signed-off-by Miaoqian Lin <[email protected]>
Looks good to me,
Reviewed-by Romain Perier <[email protected]>