On Wed, May 01, 2024 at 11:43:13AM +0200, Vincenzo Mezzela wrote:
Introduce the __free attribute for scope-based resource management.How was all of this tested?
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.
Suggested-by: Julia Lawall <julia.lawall@xxxxxxxx>
Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@xxxxxxxxx>
---
drivers/base/arch_topology.c | 51 +++++++++++++++---------------------
1 file changed, 21 insertions(+), 30 deletions(-)
thanks,
greg k-h