Skip to content

Commit 13bd778

Browse files
krzkstorulf
authored andcommitted
pmdomain: imx: gpcv2: Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 3e4d109 commit 13bd778

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/pmdomain/imx/gpcv2.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14581458
.max_register = SZ_4K,
14591459
};
14601460
struct device *dev = &pdev->dev;
1461-
struct device_node *pgc_np, *np;
1461+
struct device_node *pgc_np;
14621462
struct regmap *regmap;
14631463
void __iomem *base;
14641464
int ret;
@@ -1480,7 +1480,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14801480
return ret;
14811481
}
14821482

1483-
for_each_child_of_node(pgc_np, np) {
1483+
for_each_child_of_node_scoped(pgc_np, np) {
14841484
struct platform_device *pd_pdev;
14851485
struct imx_pgc_domain *domain;
14861486
u32 domain_index;
@@ -1491,7 +1491,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14911491
ret = of_property_read_u32(np, "reg", &domain_index);
14921492
if (ret) {
14931493
dev_err(dev, "Failed to read 'reg' property\n");
1494-
of_node_put(np);
14951494
return ret;
14961495
}
14971496

@@ -1506,7 +1505,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
15061505
domain_index);
15071506
if (!pd_pdev) {
15081507
dev_err(dev, "Failed to allocate platform device\n");
1509-
of_node_put(np);
15101508
return -ENOMEM;
15111509
}
15121510

@@ -1515,7 +1513,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
15151513
sizeof(domain_data->domains[domain_index]));
15161514
if (ret) {
15171515
platform_device_put(pd_pdev);
1518-
of_node_put(np);
15191516
return ret;
15201517
}
15211518

@@ -1532,7 +1529,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
15321529
ret = platform_device_add(pd_pdev);
15331530
if (ret) {
15341531
platform_device_put(pd_pdev);
1535-
of_node_put(np);
15361532
return ret;
15371533
}
15381534
}

0 commit comments

Comments
 (0)