soc: fsl: cpm1: tsa: switch to for_each_available_child_of_node_scoped()
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Wed, 2 Oct 2024 20:21:51 +0000 (22:21 +0200)
committerChristophe Leroy <christophe.leroy@csgroup.eu>
Thu, 14 Nov 2024 07:24:49 +0000 (08:24 +0100)
commit844d098b6f33666ff544f18d7a256a46fe19328d
treec030108a88f0a87c4d21d5b648c52dc918d4581e
parent9852d85ec9d492ebef56dc5f229416c925758edc
soc: fsl: cpm1: tsa: switch to for_each_available_child_of_node_scoped()

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@gmail.com>
Acked-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20241002-tsa-scoped-v1-1-ba6a6d657f82@gmail.com
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
drivers/soc/fsl/qe/tsa.c