drivers: arch_topology: use __free attribute instead of of_node_put()
authorVincenzo Mezzela <vincenzo.mezzela@gmail.com>
Fri, 7 Jun 2024 16:33:50 +0000 (18:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2024 07:31:04 +0000 (09:31 +0200)
commit880f5f58fd1aa22540d7e24693f411f6416b86d3
tree76c8afbe45616a5a56e9e9810321c1cd46496c0c
parent97b1974547c517d8b5cba1fa0cc7213399ff0d2c
drivers: arch_topology: use __free attribute instead of of_node_put()

Introduce the __free attribute for scope-based resource management.
Resources allocated with __free are automatically released at the end of
the scope. This enhancement aims to mitigate memory management issues
associated with forgetting to release resources by utilizing __free
instead of of_node_put().

The declaration of the device_node used within the do-while loops is
moved directly within the loop so that the resource is automatically
freed at the end of each iteration.

Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@gmail.com>
Link: https://lore.kernel.org/r/20240607163350.392971-3-vincenzo.mezzela@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/arch_topology.c