@@ -432,12 +432,11 @@ static int mtk_xsphy_probe(struct platform_device *pdev)
432
432
{
433
433
struct device * dev = & pdev -> dev ;
434
434
struct device_node * np = dev -> of_node ;
435
- struct device_node * child_np ;
436
435
struct phy_provider * provider ;
437
436
struct resource * glb_res ;
438
437
struct mtk_xsphy * xsphy ;
439
438
struct resource res ;
440
- int port , retval ;
439
+ int port ;
441
440
442
441
xsphy = devm_kzalloc (dev , sizeof (* xsphy ), GFP_KERNEL );
443
442
if (!xsphy )
@@ -471,37 +470,34 @@ static int mtk_xsphy_probe(struct platform_device *pdev)
471
470
device_property_read_u32 (dev , "mediatek,src-coef" , & xsphy -> src_coef );
472
471
473
472
port = 0 ;
474
- for_each_child_of_node (np , child_np ) {
473
+ for_each_child_of_node_scoped (np , child_np ) {
475
474
struct xsphy_instance * inst ;
476
475
struct phy * phy ;
476
+ int retval ;
477
477
478
478
inst = devm_kzalloc (dev , sizeof (* inst ), GFP_KERNEL );
479
- if (!inst ) {
480
- retval = - ENOMEM ;
481
- goto put_child ;
482
- }
479
+ if (!inst )
480
+ return - ENOMEM ;
483
481
484
482
xsphy -> phys [port ] = inst ;
485
483
486
484
phy = devm_phy_create (dev , child_np , & mtk_xsphy_ops );
487
485
if (IS_ERR (phy )) {
488
486
dev_err (dev , "failed to create phy\n" );
489
- retval = PTR_ERR (phy );
490
- goto put_child ;
487
+ return PTR_ERR (phy );
491
488
}
492
489
493
490
retval = of_address_to_resource (child_np , 0 , & res );
494
491
if (retval ) {
495
492
dev_err (dev , "failed to get address resource(id-%d)\n" ,
496
493
port );
497
- goto put_child ;
494
+ return retval ;
498
495
}
499
496
500
497
inst -> port_base = devm_ioremap_resource (& phy -> dev , & res );
501
498
if (IS_ERR (inst -> port_base )) {
502
499
dev_err (dev , "failed to remap phy regs\n" );
503
- retval = PTR_ERR (inst -> port_base );
504
- goto put_child ;
500
+ return PTR_ERR (inst -> port_base );
505
501
}
506
502
507
503
inst -> phy = phy ;
@@ -512,17 +508,12 @@ static int mtk_xsphy_probe(struct platform_device *pdev)
512
508
inst -> ref_clk = devm_clk_get (& phy -> dev , "ref" );
513
509
if (IS_ERR (inst -> ref_clk )) {
514
510
dev_err (dev , "failed to get ref_clk(id-%d)\n" , port );
515
- retval = PTR_ERR (inst -> ref_clk );
516
- goto put_child ;
511
+ return PTR_ERR (inst -> ref_clk );
517
512
}
518
513
}
519
514
520
515
provider = devm_of_phy_provider_register (dev , mtk_phy_xlate );
521
516
return PTR_ERR_OR_ZERO (provider );
522
-
523
- put_child :
524
- of_node_put (child_np );
525
- return retval ;
526
517
}
527
518
528
519
static struct platform_driver mtk_xsphy_driver = {
0 commit comments