ARM: brcmstb: fix a leaked reference by adding missing of_node_put
Subsystems (7)
PATCH 1/4 ARM: brcmstb: fix a leaked reference by adding missing of_node_put
The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./arch/arm/mach-bcm/platsmp-brcmstb.c:337:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this function. ./arch/arm/mach-bcm/platsmp-brcmstb.c:341:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this functio ./arch/arm/mach-bcm/bcm63xx_smp.c:150:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 130, but without a corresponding object release within this function.
--- arch/arm/mach-bcm/bcm63xx_smp.c | 1 + arch/arm/mach-bcm/platsmp-brcmstb.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/arm/mach-bcm/bcm63xx_smp.c +1 -0
@@ -142,6 +142,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu,* return */ ret =bcm63xx_pmb_power_on_cpu (dn); +of_node_put (dn);if (ret) goto out; out:
arch/arm/mach-bcm/platsmp-brcmstb.c +5 -2
@@ -334,11 +334,14 @@ static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus) rc =setup_hifcpubiuctrl_regs (np);if (rc) -return ; + goto out_put_node; rc =setup_hifcont_regs (np);if (rc) -return ; + goto out_put_node; + +out_put_node: +of_node_put (np); }static int brcmstb_boot_secondary (unsigned int cpu,struct task_struct *idle)
Signature · 1 line
2.9.5
PATCH 2/4 ARM: mvebu: fix a leaked reference by adding missing of_node_put
The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./arch/arm/mach-mvebu/pm-board.c:135:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 88, but without a corresponding object release within this functio
--- arch/arm/mach-mvebu/pm-board.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/arm/mach-mvebu/pm-board.c +8 -3
@@ -79,7 +79,7 @@ static void mvebu_armada_pm_enter(void __iomem *sdram_reg, u32 srcmd)static int __init mvebu_armada_pm_init (void ) {struct device_node *np; -struct device_node *gpio_ctrl_np; +struct device_node *gpio_ctrl_np =NULL ;int ret =0 , i;if (!of_machine_is_compatible ("marvell,axp-gp" ))
@@ -126,18 +126,23 @@ static int __init mvebu_armada_pm_init(void) goto out; } +if (gpio_ctrl_np) +of_node_put (gpio_ctrl_np); gpio_ctrl_np = args.np; pic_raw_gpios[i] = args.args[0 ]; } gpio_ctrl =of_iomap (gpio_ctrl_np,0 ); -if (!gpio_ctrl) -return -ENOMEM ; +if (!gpio_ctrl) { + ret = -ENOMEM ; + goto out; + }mvebu_pm_suspend_init (mvebu_armada_pm_enter); out:of_node_put (np); +of_node_put (gpio_ctrl_np);return ret; }
Signature · 7 lines
2.9.5 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Gregory CLEMENT
maintainerRe: [PATCH 2/4] ARM: mvebu: fix a leaked reference by adding missing of_node_put
Hi Wen Yang,
Quoted 7 lines
The call to
of_get_next_childreturns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.Detected by coccinelle with the following warnings:
./arch/arm/mach-mvebu/pm-board.c:135:2-8: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 88, but without a corresponding object release within this functio
Quoted 8 lines
Signed-off-by Wen Yang <[email protected]>Cc Jason Cooper <[email protected]>Cc Andrew Lunn <[email protected]>Cc Gregory Clement <[email protected]>Cc Sebastian Hesselbarth <[email protected]>Cc Russell King <[email protected]>
Applied on mvebu/arm
Thanks,
Gregory
Quoted 46 lines
--- arch/arm/mach-mvebu/pm-board.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)arch/arm/mach-mvebu/pm-board.c +8
-3@@ -79,7 +79,7 @@ static void mvebu_armada_pm_enter(void __iomem *sdram_reg, u32 srcmd)static int __init mvebu_armada_pm_init (void ) {struct device_node *np; -struct device_node *gpio_ctrl_np; +struct device_node *gpio_ctrl_np =NULL ;int ret =0 , i;if (!of_machine_is_compatible ("marvell,axp-gp" ))@@ -126,18 +126,23 @@ static int __init mvebu_armada_pm_init(void) goto out; } +if (gpio_ctrl_np) +of_node_put (gpio_ctrl_np); gpio_ctrl_np = args.np; pic_raw_gpios[i] = args.args[0 ]; } gpio_ctrl =of_iomap (gpio_ctrl_np,0 ); -if (!gpio_ctrl) -return -ENOMEM ; +if (!gpio_ctrl) { + ret = -ENOMEM ; + goto out; + }mvebu_pm_suspend_init (mvebu_armada_pm_enter); out:of_node_put (np); +of_node_put (gpio_ctrl_np);return ret; }Signature · 1 line
2.9.5
Signature · 3 lines
Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com
PATCH 3/4 ARM: rockchip: fix a leaked reference by adding missing of_node_put
In reply to Wen YangThe call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./arch/arm/mach-rockchip/platsmp.c:250:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:260:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:263:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
--- arch/arm/mach-rockchip/platsmp.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-rockchip/platsmp.c +1 -0
@@ -245,6 +245,7 @@ static int __init rockchip_smp_prepare_pmu(void) } pmu_base =of_iomap (node,0 ); +of_node_put (node);if (!pmu_base) {pr_err ("%s: could not map pmu registers\n" , __func__);return -ENOMEM ;
Signature · 1 line
2.9.5
Heiko Stuebner
maintainerRe: [PATCH 3/4] ARM: rockchip: fix a leaked reference by adding missing of_node_put
Am Dienstag, 5. März 2019, 12:32:56 CEST schrieb Wen Yang:
Quoted 9 lines
The call to
of_get_next_childreturns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.Detected by coccinelle with the following warnings:
./arch/arm/mach-rockchip/platsmp.c:250:2-8: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:260:2-8: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. ./arch/arm/mach-rockchip/platsmp.c:263:1-7: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
Quoted 6 lines
Signed-off-by Wen Yang <[email protected]>Cc Russell King <[email protected]>Cc Heiko Stuebner <[email protected]>
applied for 5.2 after adapting the patch subject a little bit
Thanks
Heiko
PATCH 4/4 ARM: sunxi: fix a leaked reference by adding missing of_node_put
In reply to Wen YangThe call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./arch/arm/mach-sunxi/mc_smp.c:110:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 97, but without a corresponding object release within this functio ./arch/arm/mach-sunxi/platsmp.c:138:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 129, but without a corresponding object release within this function
--- arch/arm/mach-sunxi/mc_smp.c | 5 ++++- arch/arm/mach-sunxi/platsmp.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/mc_smp.c +4 -1
@@ -89,6 +89,7 @@ static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster) {struct device_node *node;int cpu = cluster *SUNXI_CPUS_PER_CLUSTER + core; +bool is_compatible; node =of_cpu_device_node_get (cpu);
@@ -107,7 +108,9 @@ static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster)return false; } -return of_device_is_compatible (node,"arm,cortex-a15" ); + is_compatible =of_device_is_compatible (node,"arm,cortex-a15" ); +of_node_put (node); +return is_compatible; } static int sunxi_cpu_power_switch_set(unsigned int cpu, unsigned int cluster,
arch/arm/mach-sunxi/platsmp.c +2 -0
@@ -135,6 +135,7 @@ static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus) } prcm_membase =of_iomap (node,0 ); +of_node_put (node);if (!prcm_membase) {pr_err ("Couldn't map A23 PRCM registers\n" );return ;
@@ -148,6 +149,7 @@ static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus) } cpucfg_membase =of_iomap (node,0 ); +of_node_put (node);if (!cpucfg_membase)pr_err ("Couldn't map A23 CPU config registers\n" );
Signature · 1 line
2.9.5
Maxime Ripard
AppliedRe: [PATCH 4/4] ARM: sunxi: fix a leaked reference by adding missing of_node_put
Quoted 8 lines · Wen Yang
The call to
of_get_next_childreturns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.Detected by coccinelle with the following warnings:
./arch/arm/mach-sunxi/mc_smp.c:110:1-7: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 97, but without a corresponding object release within this functio ./arch/arm/mach-sunxi/platsmp.c:138:2-8: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 129, but without a corresponding object release within this function
Quoted 6 lines
Signed-off-by Wen Yang <[email protected]>Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Cc Russell King <[email protected]>Cc [email protected] (open list)
Applied, thanks!
Maxime
Signature · 3 lines
Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 8 lines · Wen Yang
The call to
of_get_next_childreturns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.Detected by coccinelle with the following warnings:
./arch/arm/mach-bcm/platsmp-brcmstb.c:337:2-8: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this function. ./arch/arm/mach-bcm/platsmp-brcmstb.c:341:2-8: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this functio ./arch/arm/mach-bcm/bcm63xx_smp.c:150:1-7: ERROR: missingof_node_put; acquired a node pointer with refcount incremented on line 130, but without a corresponding object release within this function.
I would actually lump that in your [PATCH v2 02/15] ARM: bcm: fix a leaked reference by adding missing of_node_put patch since the subject of that one is correct.
Thanks!
Signature · 1 line
Florian