Skip to content

Commit 612f9fc

Browse files
krzkvinodkoul
authored andcommitted
phy: cadence: sierra: Simplify with scoped for each OF child loop
Use scoped for_each_available_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: Vinod Koul <[email protected]>
1 parent a7f1dbf commit 612f9fc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/phy/cadence/phy-cadence-sierra.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
13661366
unsigned int id_value;
13671367
int ret, node = 0;
13681368
void __iomem *base;
1369-
struct device_node *dn = dev->of_node, *child;
1369+
struct device_node *dn = dev->of_node;
13701370

13711371
if (of_get_child_count(dn) == 0)
13721372
return -ENODEV;
@@ -1438,7 +1438,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
14381438

14391439
sp->autoconf = of_property_read_bool(dn, "cdns,autoconf");
14401440

1441-
for_each_available_child_of_node(dn, child) {
1441+
for_each_available_child_of_node_scoped(dn, child) {
14421442
struct phy *gphy;
14431443

14441444
if (!(of_node_name_eq(child, "phy") ||
@@ -1452,7 +1452,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
14521452
dev_err(dev, "failed to get reset %s\n",
14531453
child->full_name);
14541454
ret = PTR_ERR(sp->phys[node].lnk_rst);
1455-
of_node_put(child);
14561455
goto put_control;
14571456
}
14581457

@@ -1461,7 +1460,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
14611460
if (ret) {
14621461
dev_err(dev, "missing property in node %s\n",
14631462
child->name);
1464-
of_node_put(child);
14651463
reset_control_put(sp->phys[node].lnk_rst);
14661464
goto put_control;
14671465
}
@@ -1475,7 +1473,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
14751473
gphy = devm_phy_create(dev, child, &noop_ops);
14761474
if (IS_ERR(gphy)) {
14771475
ret = PTR_ERR(gphy);
1478-
of_node_put(child);
14791476
reset_control_put(sp->phys[node].lnk_rst);
14801477
goto put_control;
14811478
}

0 commit comments

Comments
 (0)