diff options
author | Shresth Prasad <shresthprasad7@gmail.com> | 2024-04-28 13:52:27 +0200 |
---|---|---|
committer | Rob Herring (Arm) <robh@kernel.org> | 2024-05-03 14:50:04 +0200 |
commit | 3fe5a2b9e7b4f2dad254b9c5a8e926cbcdebb49c (patch) | |
tree | 8af5b1741fb15e91f03b5af7bb5c8977bb7d37b0 /drivers | |
parent | of: reserved_mem: Remove the use of phandle from the reserved_mem APIs (diff) | |
download | linux-3fe5a2b9e7b4f2dad254b9c5a8e926cbcdebb49c.tar.xz linux-3fe5a2b9e7b4f2dad254b9c5a8e926cbcdebb49c.zip |
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 <julia.lawall@inria.fr>
Signed-off-by: Shresth Prasad <shresthprasad7@gmail.com>
Link: https://lore.kernel.org/r/20240428115226.41345-2-shresthprasad7@gmail.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/of/property.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/of/property.c b/drivers/of/property.c index 4ede45001025..8d2477ff8930 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -576,7 +576,8 @@ EXPORT_SYMBOL_GPL(of_prop_next_string); int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint) { - struct device_node *port_node = of_get_parent(node); + struct device_node *port_node __free(device_node) = + of_get_parent(node); WARN_ONCE(!port_node, "%s(): endpoint %pOF has no parent node\n", __func__, node); @@ -591,8 +592,6 @@ int of_graph_parse_endpoint(const struct device_node *node, of_property_read_u32(port_node, "reg", &endpoint->port); of_property_read_u32(node, "reg", &endpoint->id); - of_node_put(port_node); - return 0; } EXPORT_SYMBOL(of_graph_parse_endpoint); |