Message ID | 5e684d7b236904e5f79324a5e5357c2930f7402d.1716974368.git.geert+renesas@glider.be (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | pmdomain: renesas: rmobile-sysc: Use for_each_child_of_node_scoped() | expand |
On Wed, 29 May 2024 at 11:20, Geert Uytterhoeven <geert+renesas@glider.be> wrote: > > Use the scoped variant of for_each_child_of_node() to simplify cleanup > handling. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Applied for next, thanks! Kind regards Uffe > --- > drivers/pmdomain/renesas/rmobile-sysc.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/pmdomain/renesas/rmobile-sysc.c b/drivers/pmdomain/renesas/rmobile-sysc.c > index cc1f6f8b7a746850..5a1d2da465fb2c6f 100644 > --- a/drivers/pmdomain/renesas/rmobile-sysc.c > +++ b/drivers/pmdomain/renesas/rmobile-sysc.c > @@ -237,9 +237,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; > > @@ -248,10 +246,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; > -- > 2.34.1 >
diff --git a/drivers/pmdomain/renesas/rmobile-sysc.c b/drivers/pmdomain/renesas/rmobile-sysc.c index cc1f6f8b7a746850..5a1d2da465fb2c6f 100644 --- a/drivers/pmdomain/renesas/rmobile-sysc.c +++ b/drivers/pmdomain/renesas/rmobile-sysc.c @@ -237,9 +237,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; @@ -248,10 +246,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;
Use the scoped variant of for_each_child_of_node() to simplify cleanup handling. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- drivers/pmdomain/renesas/rmobile-sysc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)