Subject: Re: [PATCH] soc: fsl: cpm1: tsa: switch to for_each_available_child_of_node_scoped()

From: Herve Codina <[email-masked]>
Date: Thu, 14 Nov 2024 08:14:31 +0100

Hi Javier,

On Wed, 02 Oct 2024 22:21:51 +0200
Javier Carrasco <[email-masked]> wrote:

> The non-scoped variant of this macro turns error-prone as soon as error
> paths are included, because explicit calls to of_node_put() are required
> to avoid leaking memory.
> 
> Using its scoped counterpart simplifies the code by removing the need of
> explicit calls to of_node_put(), as they are automatically triggered as
> soon as the child node goes out of scope. Moreover, it is more robust as
> it accounts for new error paths without having to worry about
> decrementing the object's refcount.
> 
> Note that the device_node is declared within the macro, and its explicit
> declaration can be dropped as well if it is not used anywhere else.
> 
> Signed-off-by: Javier Carrasco <[email-masked]>
> ---
>  drivers/soc/fsl/qe/tsa.c | 28 ++++------------------------
>  1 file changed, 4 insertions(+), 24 deletions(-)

Acked-by: Herve Codina <[email-masked]>

Best regards,
Hervé