Re: [PATCH 3/7] mtd: rawnand: ingenic: Simplify with scoped for each OF child loop

Paul Cercueil
2026-01-02T22:23:35Z

Hi Krzysztof,

Le vendredi 02 janvier 2026 à 13:49 +0100, Krzysztof Kozlowski a
écrit :
> Use scoped for-each loop when iterating over device nodes to make
> code a
> bit simpler.
>
> Signed-off-by: Krzysztof Kozlowski
> <krzysztof.kozlowski@oss.qualcomm.com>

Reviewed-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> index 47dc3efcee92..f1e2c82936b3 100644
> --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> @@ -438,7 +438,6 @@ static int ingenic_nand_init_chips(struct
> ingenic_nfc *nfc,
>      struct platform_device *pdev)
>  {
>   struct device *dev = &pdev->dev;
> - struct device_node *np;
>   int i = 0;
>   int ret;
>   int num_chips = of_get_child_count(dev->of_node);
> @@ -449,11 +448,10 @@ static int ingenic_nand_init_chips(struct
> ingenic_nfc *nfc,
>   return -EINVAL;
>   }
>
> - for_each_child_of_node(dev->of_node, np) {
> + for_each_child_of_node_scoped(dev->of_node, np) {
>   ret = ingenic_nand_init_chip(pdev, nfc, np, i);
>   if (ret) {
>   ingenic_nand_cleanup_chips(nfc);
> - of_node_put(np);
>   return ret;
>   }