Skip to content

Commit 3fe5a2b

Browse files
Yttrium-32robherring
authored andcommitted
of: property: Use scope based cleanup on port_node
Use __free cleanup handler which ensures that the resource is freed when it goes out of scope, thus removing the need to manually clean it up using of_node_put. Suggested-by: Julia Lawall <[email protected]> Signed-off-by: Shresth Prasad <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent c56436e commit 3fe5a2b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/of/property.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ EXPORT_SYMBOL_GPL(of_prop_next_string);
576576
int of_graph_parse_endpoint(const struct device_node *node,
577577
struct of_endpoint *endpoint)
578578
{
579-
struct device_node *port_node = of_get_parent(node);
579+
struct device_node *port_node __free(device_node) =
580+
of_get_parent(node);
580581

581582
WARN_ONCE(!port_node, "%s(): endpoint %pOF has no parent node\n",
582583
__func__, node);
@@ -591,8 +592,6 @@ int of_graph_parse_endpoint(const struct device_node *node,
591592
of_property_read_u32(port_node, "reg", &endpoint->port);
592593
of_property_read_u32(node, "reg", &endpoint->id);
593594

594-
of_node_put(port_node);
595-
596595
return 0;
597596
}
598597
EXPORT_SYMBOL(of_graph_parse_endpoint);

0 commit comments

Comments
 (0)