Skip to content

Commit 196e9f5

Browse files
geertustorulf
authored andcommitted
pmdomain: renesas: rmobile-sysc: Use for_each_child_of_node_scoped()
Use the scoped variant of for_each_child_of_node() to simplify cleanup handling. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/5e684d7b236904e5f79324a5e5357c2930f7402d.1716974368.git.geert+renesas@glider.be Signed-off-by: Ulf Hansson <[email protected]>
1 parent 0ddaf2c commit 196e9f5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/pmdomain/renesas/rmobile-sysc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,7 @@ static int __init rmobile_add_pm_domains(void __iomem *base,
268268
struct device_node *parent,
269269
struct generic_pm_domain *genpd_parent)
270270
{
271-
struct device_node *np;
272-
273-
for_each_child_of_node(parent, np) {
271+
for_each_child_of_node_scoped(parent, np) {
274272
struct rmobile_pm_domain *pd;
275273
u32 idx = ~0;
276274

@@ -279,10 +277,8 @@ static int __init rmobile_add_pm_domains(void __iomem *base,
279277
}
280278

281279
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
282-
if (!pd) {
283-
of_node_put(np);
280+
if (!pd)
284281
return -ENOMEM;
285-
}
286282

287283
pd->genpd.name = np->name;
288284
pd->base = base;

0 commit comments

Comments
 (0)