of: platform: fix OF node refcount leak

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

Fixes: 3aa0582fdb ("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>
This commit is contained in:
Sudeep Holla 2018-01-18 10:43:39 +00:00 committed by Arnd Bergmann
parent 95140ed16d
commit e2105ca8be

View File

@ -519,8 +519,10 @@ static int __init of_platform_default_populate_init(void)
of_platform_device_create(node, NULL, NULL); of_platform_device_create(node, NULL, NULL);
node = of_find_node_by_path("/firmware"); node = of_find_node_by_path("/firmware");
if (node) if (node) {
of_platform_populate(node, NULL, NULL, NULL); of_platform_populate(node, NULL, NULL, NULL);
of_node_put(node);
}
/* Populate everything else. */ /* Populate everything else. */
of_platform_default_populate(NULL, NULL, NULL); of_platform_default_populate(NULL, NULL, NULL);