@@ -527,7 +527,6 @@ static int mt6323_led_probe(struct platform_device *pdev)
527
527
{
528
528
struct device * dev = & pdev -> dev ;
529
529
struct device_node * np = dev_of_node (dev );
530
- struct device_node * child ;
531
530
struct mt6397_chip * hw = dev_get_drvdata (dev -> parent );
532
531
struct mt6323_leds * leds ;
533
532
struct mt6323_led * led ;
@@ -565,28 +564,25 @@ static int mt6323_led_probe(struct platform_device *pdev)
565
564
return ret ;
566
565
}
567
566
568
- for_each_available_child_of_node (np , child ) {
567
+ for_each_available_child_of_node_scoped (np , child ) {
569
568
struct led_init_data init_data = {};
570
569
bool is_wled ;
571
570
572
571
ret = of_property_read_u32 (child , "reg" , & reg );
573
572
if (ret ) {
574
573
dev_err (dev , "Failed to read led 'reg' property\n" );
575
- goto put_child_node ;
574
+ return ret ;
576
575
}
577
576
578
577
if (reg >= max_leds || reg >= MAX_SUPPORTED_LEDS ||
579
578
leds -> led [reg ]) {
580
579
dev_err (dev , "Invalid led reg %u\n" , reg );
581
- ret = - EINVAL ;
582
- goto put_child_node ;
580
+ return - EINVAL ;
583
581
}
584
582
585
583
led = devm_kzalloc (dev , sizeof (* led ), GFP_KERNEL );
586
- if (!led ) {
587
- ret = - ENOMEM ;
588
- goto put_child_node ;
589
- }
584
+ if (!led )
585
+ return - ENOMEM ;
590
586
591
587
is_wled = of_property_read_bool (child , "mediatek,is-wled" );
592
588
@@ -612,7 +608,7 @@ static int mt6323_led_probe(struct platform_device *pdev)
612
608
if (ret < 0 ) {
613
609
dev_err (leds -> dev ,
614
610
"Failed to LED set default from devicetree\n" );
615
- goto put_child_node ;
611
+ return ret ;
616
612
}
617
613
618
614
init_data .fwnode = of_fwnode_handle (child );
@@ -621,15 +617,11 @@ static int mt6323_led_probe(struct platform_device *pdev)
621
617
& init_data );
622
618
if (ret ) {
623
619
dev_err (dev , "Failed to register LED: %d\n" , ret );
624
- goto put_child_node ;
620
+ return ret ;
625
621
}
626
622
}
627
623
628
624
return 0 ;
629
-
630
- put_child_node :
631
- of_node_put (child );
632
- return ret ;
633
625
}
634
626
635
627
static void mt6323_led_remove (struct platform_device * pdev )
0 commit comments