[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241114081431.23296fd9@bootlin.com>
Date: Thu, 14 Nov 2024 08:14:31 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Qiang Zhao <qiang.zhao@....com>, Christophe Leroy
<christophe.leroy@...roup.eu>, linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] soc: fsl: cpm1: tsa: switch to
for_each_available_child_of_node_scoped()
Hi Javier,
On Wed, 02 Oct 2024 22:21:51 +0200
Javier Carrasco <javier.carrasco.cruz@...il.com> 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 <javier.carrasco.cruz@...il.com>
> ---
> drivers/soc/fsl/qe/tsa.c | 28 ++++------------------------
> 1 file changed, 4 insertions(+), 24 deletions(-)
Acked-by: Herve Codina <herve.codina@...tlin.com>
Best regards,
Hervé
Powered by blists - more mailing lists