Skip to content

Commit b1e6351

Browse files
krzkgregkh
authored andcommitted
pmdomain: imx: gpcv2: Simplify with scoped for each OF child loop
[ Upstream commit 13bd778 ] Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240823-cleanup-h-guard-pm-domain-v1-4-8320722eaf39@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Stable-dep-of: 469c068 ("pmdomain: imx: gpcv2: fix an OF node reference leak in imx_gpcv2_probe()") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b613a03 commit b1e6351

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
@@ -1449,7 +1449,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14491449
.max_register = SZ_4K,
14501450
};
14511451
struct device *dev = &pdev->dev;
1452-
struct device_node *pgc_np, *np;
1452+
struct device_node *pgc_np;
14531453
struct regmap *regmap;
14541454
void __iomem *base;
14551455
int ret;
@@ -1471,7 +1471,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14711471
return ret;
14721472
}
14731473

1474-
for_each_child_of_node(pgc_np, np) {
1474+
for_each_child_of_node_scoped(pgc_np, np) {
14751475
struct platform_device *pd_pdev;
14761476
struct imx_pgc_domain *domain;
14771477
u32 domain_index;
@@ -1482,7 +1482,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14821482
ret = of_property_read_u32(np, "reg", &domain_index);
14831483
if (ret) {
14841484
dev_err(dev, "Failed to read 'reg' property\n");
1485-
of_node_put(np);
14861485
return ret;
14871486
}
14881487

@@ -1497,7 +1496,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14971496
domain_index);
14981497
if (!pd_pdev) {
14991498
dev_err(dev, "Failed to allocate platform device\n");
1500-
of_node_put(np);
15011499
return -ENOMEM;
15021500
}
15031501

@@ -1506,7 +1504,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
15061504
sizeof(domain_data->domains[domain_index]));
15071505
if (ret) {
15081506
platform_device_put(pd_pdev);
1509-
of_node_put(np);
15101507
return ret;
15111508
}
15121509

@@ -1523,7 +1520,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
15231520
ret = platform_device_add(pd_pdev);
15241521
if (ret) {
15251522
platform_device_put(pd_pdev);
1526-
of_node_put(np);
15271523
return ret;
15281524
}
15291525
}

0 commit comments

Comments
 (0)