Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Shresth Prasad and committed by
Rob Herring (Arm)
3fe5a2b9 c56436ef

+2 -3
+2 -3
drivers/of/property.c
··· 576 576 int of_graph_parse_endpoint(const struct device_node *node, 577 577 struct of_endpoint *endpoint) 578 578 { 579 - struct device_node *port_node = of_get_parent(node); 579 + struct device_node *port_node __free(device_node) = 580 + of_get_parent(node); 580 581 581 582 WARN_ONCE(!port_node, "%s(): endpoint %pOF has no parent node\n", 582 583 __func__, node); ··· 591 590 */ 592 591 of_property_read_u32(port_node, "reg", &endpoint->port); 593 592 of_property_read_u32(node, "reg", &endpoint->id); 594 - 595 - of_node_put(port_node); 596 593 597 594 return 0; 598 595 }