]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
pmdomain: renesas: rmobile-sysc: Use for_each_child_of_node_scoped()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 29 May 2024 09:20:20 +0000 (11:20 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 5 Jun 2024 09:52:39 +0000 (11:52 +0200)
Use the scoped variant of for_each_child_of_node() to simplify cleanup
handling.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/5e684d7b236904e5f79324a5e5357c2930f7402d.1716974368.git.geert+renesas@glider.be
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/renesas/rmobile-sysc.c

index 0b77f37787d58f48d7801208dcd2b5c8a1f17adb..5848e79aa438d12b5a40ff0c57eaa81a0741c4a6 100644 (file)
@@ -268,9 +268,7 @@ static int __init rmobile_add_pm_domains(void __iomem *base,
                                         struct device_node *parent,
                                         struct generic_pm_domain *genpd_parent)
 {
-       struct device_node *np;
-
-       for_each_child_of_node(parent, np) {
+       for_each_child_of_node_scoped(parent, np) {
                struct rmobile_pm_domain *pd;
                u32 idx = ~0;
 
@@ -279,10 +277,8 @@ static int __init rmobile_add_pm_domains(void __iomem *base,
                }
 
                pd = kzalloc(sizeof(*pd), GFP_KERNEL);
-               if (!pd) {
-                       of_node_put(np);
+               if (!pd)
                        return -ENOMEM;
-               }
 
                pd->genpd.name = np->name;
                pd->base = base;