device property: preserve usecount for node passed to of_fwnode_graph_get_port_parent()
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tue, 22 Aug 2017 00:19:12 +0000 (02:19 +0200)
committerRob Herring <robh@kernel.org>
Thu, 12 Oct 2017 17:26:14 +0000 (12:26 -0500)
Using CONFIG_OF_DYNAMIC=y uncovered an imbalance in the usecount of the
node being passed to of_fwnode_graph_get_port_parent(). Preserve the
usecount by using of_get_parent() instead of of_get_next_parent() which
don't decrement the usecount of the node passed to it.

Fixes: 3b27d00e7b6d7c88 ("device property: Move fwnode graph ops to firmware specific locations")
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/property.c

index fbb72116e9d456b8a08672391de9e2cc144ed171..264c355ba1ffc5f9474dd5a1bcf9696fa9cf7d4b 100644 (file)
@@ -954,7 +954,7 @@ of_fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
        struct device_node *np;
 
        /* Get the parent of the port */
-       np = of_get_next_parent(to_of_node(fwnode));
+       np = of_get_parent(to_of_node(fwnode));
        if (!np)
                return NULL;