[PATCH] of: platform: fix OF node refcount leak
From: Sudeep Holla
Date: Tue Jan 16 2018 - 12:17:28 EST
We need to call of_node_put() for device nodes obtained with
of_find_node_by_path().
Reported-by: Loys Ollivier <lollivier@xxxxxxxxxxxx>
Cc: Rob Herring <robh+dt@xxxxxxxxxx>
Cc: Frank Rowand <frowand.list@xxxxxxxxx>
Signed-off-by: Sudeep Holla <sudeep.holla@xxxxxxx>
---
drivers/of/platform.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
2.7.4