diff mbox

[2/7] arm: mach-shmobile: pm-rmobile: add missing of_node_put after calling of_parse_phandle

Message ID 1467366121-14120-3-git-send-email-peter.chen@nxp.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Peter Chen July 1, 2016, 9:41 a.m. UTC
of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Cc: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 arch/arm/mach-shmobile/pm-rmobile.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Geert Uytterhoeven July 1, 2016, 12:31 p.m. UTC | #1
Hi Peter,

On Fri, Jul 1, 2016 at 11:41 AM, Peter Chen <peter.chen@nxp.com> wrote:
> of_node_put needs to be called when the device node which is got
> from of_parse_phandle has finished using.
>
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>

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

> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -209,6 +209,7 @@ static void __init add_special_pd(struct device_node *np, enum pd_types type)
>         special_pds[num_special_pds].pd = pd;

The pd pointer is stored in the line above, and released later in
put_special_pds().

>         special_pds[num_special_pds].type = type;
>         num_special_pds++;
> +       of_node_put(pd);

Hence it must not be released here, as that would cause a double release
when put_special_pds() is executed.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter Chen July 4, 2016, 2:10 a.m. UTC | #2
>On Fri, Jul 1, 2016 at 11:41 AM, Peter Chen <peter.chen@nxp.com> wrote:

>> of_node_put needs to be called when the device node which is got from

>> of_parse_phandle has finished using.

>>

>> Cc: Simon Horman <horms@verge.net.au>

>> Cc: Magnus Damm <magnus.damm@gmail.com>

>> Signed-off-by: Peter Chen <peter.chen@nxp.com>

>

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

>

>> --- a/arch/arm/mach-shmobile/pm-rmobile.c

>> +++ b/arch/arm/mach-shmobile/pm-rmobile.c

>> @@ -209,6 +209,7 @@ static void __init add_special_pd(struct device_node *np,

>enum pd_types type)

>>         special_pds[num_special_pds].pd = pd;

>

>The pd pointer is stored in the line above, and released later in put_special_pds().

>

>>         special_pds[num_special_pds].type = type;

>>         num_special_pds++;

>> +       of_node_put(pd);

>

>Hence it must not be released here, as that would cause a double release when

>put_special_pds() is executed.

>


Thanks, Geert, it is my careless.

Please forget this patch.

Peter
diff mbox

Patch

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index c0b05e9..8eb2cb6 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -209,6 +209,7 @@  static void __init add_special_pd(struct device_node *np, enum pd_types type)
 	special_pds[num_special_pds].pd = pd;
 	special_pds[num_special_pds].type = type;
 	num_special_pds++;
+	of_node_put(pd);
 }
 
 static void __init get_special_pds(void)