@@ -1577,12 +1577,11 @@ static int mtk_tphy_probe(struct platform_device *pdev)
1577
1577
{
1578
1578
struct device * dev = & pdev -> dev ;
1579
1579
struct device_node * np = dev -> of_node ;
1580
- struct device_node * child_np ;
1581
1580
struct phy_provider * provider ;
1582
1581
struct resource * sif_res ;
1583
1582
struct mtk_tphy * tphy ;
1584
1583
struct resource res ;
1585
- int port , retval ;
1584
+ int port ;
1586
1585
1587
1586
tphy = devm_kzalloc (dev , sizeof (* tphy ), GFP_KERNEL );
1588
1587
if (!tphy )
@@ -1623,40 +1622,36 @@ static int mtk_tphy_probe(struct platform_device *pdev)
1623
1622
}
1624
1623
1625
1624
port = 0 ;
1626
- for_each_child_of_node (np , child_np ) {
1625
+ for_each_child_of_node_scoped (np , child_np ) {
1627
1626
struct mtk_phy_instance * instance ;
1628
1627
struct clk_bulk_data * clks ;
1629
1628
struct device * subdev ;
1630
1629
struct phy * phy ;
1630
+ int retval ;
1631
1631
1632
1632
instance = devm_kzalloc (dev , sizeof (* instance ), GFP_KERNEL );
1633
- if (!instance ) {
1634
- retval = - ENOMEM ;
1635
- goto put_child ;
1636
- }
1633
+ if (!instance )
1634
+ return - ENOMEM ;
1637
1635
1638
1636
tphy -> phys [port ] = instance ;
1639
1637
1640
1638
phy = devm_phy_create (dev , child_np , & mtk_tphy_ops );
1641
1639
if (IS_ERR (phy )) {
1642
1640
dev_err (dev , "failed to create phy\n" );
1643
- retval = PTR_ERR (phy );
1644
- goto put_child ;
1641
+ return PTR_ERR (phy );
1645
1642
}
1646
1643
1647
1644
subdev = & phy -> dev ;
1648
1645
retval = of_address_to_resource (child_np , 0 , & res );
1649
1646
if (retval ) {
1650
1647
dev_err (subdev , "failed to get address resource(id-%d)\n" ,
1651
1648
port );
1652
- goto put_child ;
1649
+ return retval ;
1653
1650
}
1654
1651
1655
1652
instance -> port_base = devm_ioremap_resource (subdev , & res );
1656
- if (IS_ERR (instance -> port_base )) {
1657
- retval = PTR_ERR (instance -> port_base );
1658
- goto put_child ;
1659
- }
1653
+ if (IS_ERR (instance -> port_base ))
1654
+ return PTR_ERR (instance -> port_base );
1660
1655
1661
1656
instance -> phy = phy ;
1662
1657
instance -> index = port ;
@@ -1668,19 +1663,16 @@ static int mtk_tphy_probe(struct platform_device *pdev)
1668
1663
clks [1 ].id = "da_ref" ; /* analog clock */
1669
1664
retval = devm_clk_bulk_get_optional (subdev , TPHY_CLKS_CNT , clks );
1670
1665
if (retval )
1671
- goto put_child ;
1666
+ return retval ;
1672
1667
1673
1668
retval = phy_type_syscon_get (instance , child_np );
1674
1669
if (retval )
1675
- goto put_child ;
1670
+ return retval ;
1676
1671
}
1677
1672
1678
1673
provider = devm_of_phy_provider_register (dev , mtk_phy_xlate );
1679
1674
1680
1675
return PTR_ERR_OR_ZERO (provider );
1681
- put_child :
1682
- of_node_put (child_np );
1683
- return retval ;
1684
1676
}
1685
1677
1686
1678
static struct platform_driver mtk_tphy_driver = {
0 commit comments