Re: [PATCH next] cpupfreq: tegra124: eliminate uses of of_node_put()

From: Viresh Kumar
Date: Fri Apr 19 2024 - 02:28:55 EST


On 07-04-24, 22:15, Javier Carrasco wrote:
> Make use of the __free() cleanup handler to automatically free nodes
> when they get out of scope. Only the probe function is affected by this
> modification.
>
> Given that this mechanism requires the node to be initialized, its
> initialization and the value check have been moved to the top of the
> function.
>
> After removing uses of of_node_put(), the jump to out_put_np is no
> longer necessary.
>
> Suggested-by: Julia Lawall <julia.lawall@xxxxxxxx>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>
> ---
> This patch is a proof of concept to remove uses of of_node_put() in
> cpufreq, which can be replaced with the clenaup handler introduced with
> 54da6a092431 ("locking: Introduce __cleanup() based infrastructure").
>
> This change provides a scope-based cleanup mechanism to avoid potential
> memory leaks that can appear if of_node_put() is not used correctly.
>
> The patch is based on the latest linux-next tag (next-20240405).
> ---
> drivers/cpufreq/tegra124-cpufreq.c | 19 ++++++-------------
> 1 file changed, 6 insertions(+), 13 deletions(-)

Applied. Thanks.

--
viresh