diff mbox series

[-next] of: platform: fix OF node refcount leak

Message ID 1516272219-25359-1-git-send-email-sudeep.holla@arm.com
State New
Headers show
Series [-next] of: platform: fix OF node refcount leak | expand

Commit Message

Sudeep Holla Jan. 18, 2018, 10:43 a.m. UTC
We need to call of_node_put() for device nodes obtained with
of_find_node_by_path().

Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()")
Reported-by: Loys Ollivier <lollivier@baylibre.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

---
 drivers/of/platform.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Hi Rob,

You had Acked the original patch and it's queued via ARM SoC. So can you
please provide ack on this if you are OK with the change.

Regards,
Sudeep

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Rob Herring Jan. 18, 2018, 2:57 p.m. UTC | #1
On Thu, Jan 18, 2018 at 4:43 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:
> We need to call of_node_put() for device nodes obtained with

> of_find_node_by_path().

>

> Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()")

> Reported-by: Loys Ollivier <lollivier@baylibre.com>

> Cc: Rob Herring <robh+dt@kernel.org>

> Cc: Frank Rowand <frowand.list@gmail.com>

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

> ---

>  drivers/of/platform.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

>

> Hi Rob,

>

> You had Acked the original patch and it's queued via ARM SoC. So can you

> please provide ack on this if you are OK with the change.


Acked-by: Rob Herring <robh@kernel.org>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sudeep Holla Jan. 19, 2018, 3:37 p.m. UTC | #2
Hi Andy,

On 18/01/18 10:43, Sudeep Holla wrote:
> We need to call of_node_put() for device nodes obtained with

> of_find_node_by_path().

> 

> Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()")

> Reported-by: Loys Ollivier <lollivier@baylibre.com>

> Cc: Rob Herring <robh+dt@kernel.org>

> Cc: Frank Rowand <frowand.list@gmail.com>

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

> ---

>  drivers/of/platform.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

> 


Can you pick up this with other fixes you would send after v4.16-rc1 or
do you prefer me to route through ARM-SoC directly ? Let me know.

-- 
Regards,
Sudeep
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Gross Jan. 19, 2018, 11:34 p.m. UTC | #3
On 19 January 2018 at 09:37, Sudeep Holla <sudeep.holla@arm.com> wrote:
> Hi Andy,

>

> On 18/01/18 10:43, Sudeep Holla wrote:

>> We need to call of_node_put() for device nodes obtained with

>> of_find_node_by_path().

>>

>> Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()")

>> Reported-by: Loys Ollivier <lollivier@baylibre.com>

>> Cc: Rob Herring <robh+dt@kernel.org>

>> Cc: Frank Rowand <frowand.list@gmail.com>

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

>> ---

>>  drivers/of/platform.c | 4 +++-

>>  1 file changed, 3 insertions(+), 1 deletion(-)

>>

>

> Can you pick up this with other fixes you would send after v4.16-rc1 or

> do you prefer me to route through ARM-SoC directly ? Let me know.


I can pick this up for fixes, no problem.  I can send it along right
now if you like.  This is a pretty low risk patch.

Regards,

Andy
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sudeep Holla Jan. 22, 2018, 11:13 a.m. UTC | #4
On 19/01/18 23:34, Andy Gross wrote:
> On 19 January 2018 at 09:37, Sudeep Holla <sudeep.holla@arm.com> wrote:

>> Hi Andy,

>>

>> On 18/01/18 10:43, Sudeep Holla wrote:

>>> We need to call of_node_put() for device nodes obtained with

>>> of_find_node_by_path().

>>>

>>> Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()")

>>> Reported-by: Loys Ollivier <lollivier@baylibre.com>

>>> Cc: Rob Herring <robh+dt@kernel.org>

>>> Cc: Frank Rowand <frowand.list@gmail.com>

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

>>> ---

>>>  drivers/of/platform.c | 4 +++-

>>>  1 file changed, 3 insertions(+), 1 deletion(-)

>>>

>>

>> Can you pick up this with other fixes you would send after v4.16-rc1 or

>> do you prefer me to route through ARM-SoC directly ? Let me know.

> 

> I can pick this up for fixes, no problem.  I can send it along right

> now if you like.  This is a pretty low risk patch.

> 


Thanks Andy.

-- 
Regards,
Sudeep
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 6a01dab597c7..c00d81dfac0b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -514,8 +514,10 @@  static int __init of_platform_default_populate_init(void)
 		of_platform_device_create(node, NULL, NULL);

 	node = of_find_node_by_path("/firmware");
-	if (node)
+	if (node) {
 		of_platform_populate(node, NULL, NULL, NULL);
+		of_node_put(node);
+	}

 	/* Populate everything else. */
 	of_platform_default_populate(NULL, NULL, NULL);