diff mbox series

[01/15] ARM: actions: fix a leaked reference by addingmissing of_node_put

Message ID 1551430616-42014-1-git-send-email-wen.yang99@zte.com.cn
State New
Headers show
Series [01/15] ARM: actions: fix a leaked reference by addingmissing of_node_put | expand

Commit Message

Wen Yang March 1, 2019, 8:56 a.m. UTC
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-actions/platsmp.c:112:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 103, but without a corresponding object release within this function.
./arch/arm/mach-actions/platsmp.c:124:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 115, but without a corresponding object release within this function.
./arch/arm/mach-actions/platsmp.c:137:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 128, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-actions/platsmp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Krzysztof Kozlowski March 1, 2019, 9:14 a.m. UTC | #1
On Fri, 1 Mar 2019 at 09:57, Wen Yang <wen.yang99@zte.com.cn> wrote:
>
> 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-exynos/firmware.c:201:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 193, but without a corresponding object release within this function.
> ./arch/arm/mach-exynos/firmware.c:204:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 193, but without a corresponding object release within this function.
> ./arch/arm/mach-exynos/suspend.c:642:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 634, but without a corresponding object release within this function.

Thanks, looks good. I'll take it however after merge window.

There are no dependencies between patches therefore you could limit
the amount of people you CC. You put specific "Cc" fields in patch but
you did not use them and sent it to 40 addresses. The CC in the patch
has exactly this purpose - do not send everything to everyone...

Best regards,
Krzysztof
Geert Uytterhoeven March 1, 2019, 9:51 a.m. UTC | #2
On Fri, Mar 1, 2019 at 9:57 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> 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-shmobile/pm-rcar-gen2.c:77:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
> ./arch/arm/mach-shmobile/pm-rcar-gen2.c:85:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
> ./arch/arm/mach-shmobile/pm-rcar-gen2.c:90:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
Linus Walleij March 1, 2019, 1:30 p.m. UTC | #3
On Fri, Mar 1, 2019 at 9:57 AM Wen Yang <wen.yang99@zte.com.cn> wrote:

> 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-versatile/versatile_dt.c:315:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 302, but without a corresponding object release within this function.
> ./arch/arm/mach-versatile/versatile_dt.c:320:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 302, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org

Patch applied. Will send upstream next kernel cycle or so.

Yours,
Linus Walleij
Manivannan Sadhasivam March 1, 2019, 3:55 p.m. UTC | #4
Hi Wen,

On Fri, Mar 01, 2019 at 04:56:42PM +0800, Wen Yang wrote:
> 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-actions/platsmp.c:112:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 103, but without a corresponding object release within this function.
> ./arch/arm/mach-actions/platsmp.c:124:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 115, but without a corresponding object release within this function.
> ./arch/arm/mach-actions/platsmp.c:137:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 128, but without a corresponding object release within this function.
> 

We have a floating patch for this:
https://www.spinics.net/lists/arm-kernel/msg694544.html

Andreas: Can you please take a second look at the patchset submitted by Linus
Walleij and Russel for simplifying the Actions startup code?

Thanks,
Mani

> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  arch/arm/mach-actions/platsmp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
> index 4fd479c..1a8e078 100644
> --- a/arch/arm/mach-actions/platsmp.c
> +++ b/arch/arm/mach-actions/platsmp.c
> @@ -107,6 +107,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  	}
>  
>  	timer_base_addr = of_iomap(node, 0);
> +	of_node_put(node);
>  	if (!timer_base_addr) {
>  		pr_err("%s: could not map timer registers\n", __func__);
>  		return;
> @@ -119,6 +120,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  	}
>  
>  	sps_base_addr = of_iomap(node, 0);
> +	of_node_put(node);
>  	if (!sps_base_addr) {
>  		pr_err("%s: could not map sps registers\n", __func__);
>  		return;
> @@ -132,6 +134,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  		}
>  
>  		scu_base_addr = of_iomap(node, 0);
> +		of_node_put(node);
>  		if (!scu_base_addr) {
>  			pr_err("%s: could not map scu registers\n", __func__);
>  			return;
> -- 
> 2.9.5
>
Florian Fainelli March 1, 2019, 6:28 p.m. UTC | #5
On 3/1/19 12:56 AM, Wen Yang wrote:
> 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/board_bcm281xx.c:43:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 35, but without a corresponding object release within this function.

This looks fine, if you resubmit, can you add a missing space between
"adding" and "missing"? This applies to all of your patches, so I am
assuming you somehow scripted that, which should be easy to fix.

With that changed:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Simon Horman March 4, 2019, 10:24 a.m. UTC | #6
On Fri, Mar 01, 2019 at 10:51:27AM +0100, Geert Uytterhoeven wrote:
> On Fri, Mar 1, 2019 at 9:57 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> > 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-shmobile/pm-rcar-gen2.c:77:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
> > ./arch/arm/mach-shmobile/pm-rcar-gen2.c:85:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
> > ./arch/arm/mach-shmobile/pm-rcar-gen2.c:90:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
> >
> > Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks, applied for v5.2.
Fabrizio Castro March 4, 2019, 10:55 a.m. UTC | #7
Hello Simon,

> From: linux-renesas-soc-owner@vger.kernel.org <linux-renesas-soc-owner@vger.kernel.org> On Behalf Of Simon Horman
> Sent: 04 March 2019 10:24
> Subject: Re: [PATCH 08/15] ARM: shmobile: fix a leaked reference by addingmissing of_node_put
> 
> On Fri, Mar 01, 2019 at 10:51:27AM +0100, Geert Uytterhoeven wrote:
> > On Fri, Mar 1, 2019 at 9:57 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> > > 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-shmobile/pm-rcar-gen2.c:77:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount
> incremented on line 66, but without a corresponding object release within this function.
> > > ./arch/arm/mach-shmobile/pm-rcar-gen2.c:85:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount
> incremented on line 66, but without a corresponding object release within this function.
> > > ./arch/arm/mach-shmobile/pm-rcar-gen2.c:90:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount
> incremented on line 66, but without a corresponding object release within this function.
> > >
> > > Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Thanks, applied for v5.2.

I am sorry for commenting on this just a moment after you took the patch, I guess there is a space missing in the title s/addingmissing/adding missing/ ? Is that still fixable?

Thanks,
Fab
Linus Walleij March 4, 2019, 12:29 p.m. UTC | #8
On Fri, Mar 1, 2019 at 4:55 PM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
> Hi Wen,
>
> On Fri, Mar 01, 2019 at 04:56:42PM +0800, Wen Yang wrote:
> > 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-actions/platsmp.c:112:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 103, but without a corresponding object release within this function.
> > ./arch/arm/mach-actions/platsmp.c:124:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 115, but without a corresponding object release within this function.
> > ./arch/arm/mach-actions/platsmp.c:137:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 128, but without a corresponding object release within this function.
> >
>
> We have a floating patch for this:
> https://www.spinics.net/lists/arm-kernel/msg694544.html
>
> Andreas: Can you please take a second look at the patchset submitted by Linus
> Walleij and Russel for simplifying the Actions startup code?

Andreas wrote a version of simplifying secondary startup in the
same spirit as Russell's patches, and it's merged and all
is fine I think.

If this patch applied on top of the current upstream code I'd say
just forget about my patch and merge Wen's patch instead.

Yours,
Linus Walleij
Sudeep Holla March 4, 2019, 2:46 p.m. UTC | #9
On Fri, Mar 01, 2019 at 04:56:53PM +0800, Wen Yang wrote:
> 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-vexpress/dcscb.c:150:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 145, but without a corresponding object release within this function.
> ./arch/arm/mach-vexpress/dcscb.c:160:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 145, but without a corresponding object release within this function.
> ./arch/arm/mach-vexpress/dcscb.c:171:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 145, but without a corresponding object release within this function.
> 
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>

Looks good, assuming you want to take this as a series. Please shout if
you want us to take this.

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep
Manivannan Sadhasivam March 4, 2019, 2:48 p.m. UTC | #10
Hi Linus,

On Mon, Mar 04, 2019 at 01:29:33PM +0100, Linus Walleij wrote:
> On Fri, Mar 1, 2019 at 4:55 PM Manivannan Sadhasivam
> <manivannan.sadhasivam@linaro.org> wrote:
> > Hi Wen,
> >
> > On Fri, Mar 01, 2019 at 04:56:42PM +0800, Wen Yang wrote:
> > > 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-actions/platsmp.c:112:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 103, but without a corresponding object release within this function.
> > > ./arch/arm/mach-actions/platsmp.c:124:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 115, but without a corresponding object release within this function.
> > > ./arch/arm/mach-actions/platsmp.c:137:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 128, but without a corresponding object release within this function.
> > >
> >
> > We have a floating patch for this:
> > https://www.spinics.net/lists/arm-kernel/msg694544.html
> >
> > Andreas: Can you please take a second look at the patchset submitted by Linus
> > Walleij and Russel for simplifying the Actions startup code?
> 
> Andreas wrote a version of simplifying secondary startup in the
> same spirit as Russell's patches, and it's merged and all
> is fine I think.
> 

Oops. I think I missed that! Can you please point me to that patch? And how it
got merged? I did the PR for actions stuff this time and haven't included any
mach-actions patches.

Thanks,
Mani

> If this patch applied on top of the current upstream code I'd say
> just forget about my patch and merge Wen's patch instead.
> 
> Yours,
> Linus Walleij
Avi Fishman March 4, 2019, 3:39 p.m. UTC | #11
Reviewed-by: Avi Fishman <avifishman70@gmail.com>

Thanks

On Fri, Mar 1, 2019 at 10:57 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
>
> 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-npcm/platsmp.c:52:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 31, but without a corresponding object release within this function.
> ./arch/arm/mach-npcm/platsmp.c:68:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 60, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Avi Fishman <avifishman70@gmail.com>
> Cc: Tomer Maimon <tmaimon77@gmail.com>
> Cc: Patrick Venture <venture@google.com>
> Cc: Nancy Yuen <yuenn@google.com>
> Cc: Brendan Higgins <brendanhiggins@google.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: openbmc@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  arch/arm/mach-npcm/platsmp.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-npcm/platsmp.c b/arch/arm/mach-npcm/platsmp.c
> index 21633c7..fe63edc 100644
> --- a/arch/arm/mach-npcm/platsmp.c
> +++ b/arch/arm/mach-npcm/platsmp.c
> @@ -35,6 +35,7 @@ static int npcm7xx_smp_boot_secondary(unsigned int cpu,
>                 goto out;
>         }
>         gcr_base = of_iomap(gcr_np, 0);
> +       of_node_put(gcr_np);
>         if (!gcr_base) {
>                 pr_err("could not iomap gcr");
>                 ret = -ENOMEM;
> @@ -63,6 +64,7 @@ static void __init npcm7xx_smp_prepare_cpus(unsigned int max_cpus)
>                 return;
>         }
>         scu_base = of_iomap(scu_np, 0);
> +       of_node_put(scu_np);
>         if (!scu_base) {
>                 pr_err("could not iomap scu");
>                 return;
> --
> 2.9.5
>
Linus Walleij March 4, 2019, 10:37 p.m. UTC | #12
On Mon, Mar 4, 2019 at 3:48 PM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
> On Mon, Mar 04, 2019 at 01:29:33PM +0100, Linus Walleij wrote:
> > On Fri, Mar 1, 2019 at 4:55 PM Manivannan Sadhasivam
> > <manivannan.sadhasivam@linaro.org> wrote:
> > > Hi Wen,
> > >
> > > On Fri, Mar 01, 2019 at 04:56:42PM +0800, Wen Yang wrote:
> > > > 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-actions/platsmp.c:112:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 103, but without a corresponding object release within this function.
> > > > ./arch/arm/mach-actions/platsmp.c:124:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 115, but without a corresponding object release within this function.
> > > > ./arch/arm/mach-actions/platsmp.c:137:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 128, but without a corresponding object release within this function.
> > > >
> > >
> > > We have a floating patch for this:
> > > https://www.spinics.net/lists/arm-kernel/msg694544.html
> > >
> > > Andreas: Can you please take a second look at the patchset submitted by Linus
> > > Walleij and Russel for simplifying the Actions startup code?
> >
> > Andreas wrote a version of simplifying secondary startup in the
> > same spirit as Russell's patches, and it's merged and all
> > is fine I think.
> >
>
> Oops. I think I missed that! Can you please point me to that patch? And how it
> got merged? I did the PR for actions stuff this time and haven't included any
> mach-actions patches.

I just did git log arch/arm/mach-actions but I think it came in quite some time
ago, not last merge window:

But you see:
commit 6c2eb3e76fb84e2eb46d484f71fab469c0d9532c
"ARM: owl: smp: Drop owl_secondary_boot()"
commit bad29933fef76fb6ee577f4a0b6d145c1f52f663
"ARM: owl: smp: Use __pa_symbol()"
commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45
"ARM: owl: smp: Drop bogus holding pen"

platsmp.c looks just fine these days. Except for what Wei's patch is fixing,
of_node_put().

Yours,
Linus Walleij
Russell King (Oracle) March 5, 2019, 9:55 a.m. UTC | #13
On Tue, Mar 05, 2019 at 07:21:19AM +0530, Manivannan Sadhasivam wrote:
> On Tue, 5 Mar, 2019, 4:08 AM Linus Walleij <linus.walleij@linaro.org wrote:
> 
> > On Mon, Mar 4, 2019 at 3:48 PM Manivannan Sadhasivam
> > <manivannan.sadhasivam@linaro.org> wrote:
> > > On Mon, Mar 04, 2019 at 01:29:33PM +0100, Linus Walleij wrote:
> > > > On Fri, Mar 1, 2019 at 4:55 PM Manivannan Sadhasivam
> > > > <manivannan.sadhasivam@linaro.org> wrote:
> > > > > Hi Wen,
> > > > >
> > > > > On Fri, Mar 01, 2019 at 04:56:42PM +0800, Wen Yang wrote:
> > > > > > 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-actions/platsmp.c:112:2-8: ERROR: missing
> > of_node_put; acquired a node pointer with refcount incremented on line 103,
> > but without a corresponding object release within this function.
> > > > > > ./arch/arm/mach-actions/platsmp.c:124:2-8: ERROR: missing
> > of_node_put; acquired a node pointer with refcount incremented on line 115,
> > but without a corresponding object release within this function.
> > > > > > ./arch/arm/mach-actions/platsmp.c:137:3-9: ERROR: missing
> > of_node_put; acquired a node pointer with refcount incremented on line 128,
> > but without a corresponding object release within this function.
> > > > > >
> > > > >
> > > > > We have a floating patch for this:
> > > > > https://www.spinics.net/lists/arm-kernel/msg694544.html
> > > > >
> > > > > Andreas: Can you please take a second look at the patchset submitted
> > by Linus
> > > > > Walleij and Russel for simplifying the Actions startup code?
> > > >
> > > > Andreas wrote a version of simplifying secondary startup in the
> > > > same spirit as Russell's patches, and it's merged and all
> > > > is fine I think.
> > > >
> > >
> > > Oops. I think I missed that! Can you please point me to that patch? And
> > how it
> > > got merged? I did the PR for actions stuff this time and haven't
> > included any
> > > mach-actions patches.
> >
> > I just did git log arch/arm/mach-actions but I think it came in quite some
> > time
> > ago, not last merge window:
> >
> > But you see:
> > commit 6c2eb3e76fb84e2eb46d484f71fab469c0d9532c
> > "ARM: owl: smp: Drop owl_secondary_boot()"
> > commit bad29933fef76fb6ee577f4a0b6d145c1f52f663
> > "ARM: owl: smp: Use __pa_symbol()"
> > commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45
> > "ARM: owl: smp: Drop bogus holding pen"
> >
> > platsmp.c looks just fine these days. Except for what Wei's patch is
> > fixing,
> > of_node_put().
> >
> 
> Nope. platsmp.c still requires some cleanup like removing the redundant
> bootlock and pen_release flag as pointed out by Russel. Andreas just
> replied to your cleanup patches but there was no follow up since that. So,
> I guess we can just apply Russell's patches and this patch once Andreas is
> fine with it (it looks good to me though).

No.  My patches are in my tree queued for this merge window.  They
are part of a series that can not be broken up and merged separately
because all the per-platform patches need to be merged before the final
patch "ARM: smp: remove arch-provided "pen_release"" otherwise the
platforms break.  I thought that was already explained.
Simon Horman March 6, 2019, 1 p.m. UTC | #14
On Mon, Mar 04, 2019 at 10:55:27AM +0000, Fabrizio Castro wrote:
> Hello Simon,
> 
> > From: linux-renesas-soc-owner@vger.kernel.org <linux-renesas-soc-owner@vger.kernel.org> On Behalf Of Simon Horman
> > Sent: 04 March 2019 10:24
> > Subject: Re: [PATCH 08/15] ARM: shmobile: fix a leaked reference by addingmissing of_node_put
> > 
> > On Fri, Mar 01, 2019 at 10:51:27AM +0100, Geert Uytterhoeven wrote:
> > > On Fri, Mar 1, 2019 at 9:57 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> > > > 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-shmobile/pm-rcar-gen2.c:77:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount
> > incremented on line 66, but without a corresponding object release within this function.
> > > > ./arch/arm/mach-shmobile/pm-rcar-gen2.c:85:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount
> > incremented on line 66, but without a corresponding object release within this function.
> > > > ./arch/arm/mach-shmobile/pm-rcar-gen2.c:90:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount
> > incremented on line 66, but without a corresponding object release within this function.
> > > >
> > > > Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> > >
> > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > 
> > Thanks, applied for v5.2.
> 
> I am sorry for commenting on this just a moment after you took the patch, I guess there is a space missing in the title s/addingmissing/adding missing/ ? Is that still fixable?

Thanks for noticing, fixed.
diff mbox series

Patch

diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
index 4fd479c..1a8e078 100644
--- a/arch/arm/mach-actions/platsmp.c
+++ b/arch/arm/mach-actions/platsmp.c
@@ -107,6 +107,7 @@  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 	}
 
 	timer_base_addr = of_iomap(node, 0);
+	of_node_put(node);
 	if (!timer_base_addr) {
 		pr_err("%s: could not map timer registers\n", __func__);
 		return;
@@ -119,6 +120,7 @@  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 	}
 
 	sps_base_addr = of_iomap(node, 0);
+	of_node_put(node);
 	if (!sps_base_addr) {
 		pr_err("%s: could not map sps registers\n", __func__);
 		return;
@@ -132,6 +134,7 @@  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 		}
 
 		scu_base_addr = of_iomap(node, 0);
+		of_node_put(node);
 		if (!scu_base_addr) {
 			pr_err("%s: could not map scu registers\n", __func__);
 			return;