Skip to content

Commit

Permalink
of: platform: fix OF node refcount leak
Browse files Browse the repository at this point in the history
We need to call of_node_put() for device nodes obtained with
of_find_node_by_path().

Fixes: 3aa0582 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()")
Reported-by: Loys Ollivier <lollivier@baylibre.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Sudeep Holla authored and Arnd Bergmann committed Jan 23, 2018
1 parent 95140ed commit e2105ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/of/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,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);
Expand Down

0 comments on commit e2105ca

Please sign in to comment.