@@ -423,7 +423,6 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
423
423
struct device_node * gpio_ext_np ;
424
424
struct platform_device * gpio_ext_pdev ;
425
425
struct device * gpio_ext_dev ;
426
- struct device_node * child ;
427
426
struct netxbig_gpio_ext * gpio_ext ;
428
427
struct netxbig_led_timer * timers ;
429
428
struct netxbig_led * leds , * led ;
@@ -507,33 +506,33 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
507
506
}
508
507
509
508
led = leds ;
510
- for_each_available_child_of_node (np , child ) {
509
+ for_each_available_child_of_node_scoped (np , child ) {
511
510
const char * string ;
512
511
int * mode_val ;
513
512
int num_modes ;
514
513
515
514
ret = of_property_read_u32 (child , "mode-addr" ,
516
515
& led -> mode_addr );
517
516
if (ret )
518
- goto err_node_put ;
517
+ goto put_device ;
519
518
520
519
ret = of_property_read_u32 (child , "bright-addr" ,
521
520
& led -> bright_addr );
522
521
if (ret )
523
- goto err_node_put ;
522
+ goto put_device ;
524
523
525
524
ret = of_property_read_u32 (child , "max-brightness" ,
526
525
& led -> bright_max );
527
526
if (ret )
528
- goto err_node_put ;
527
+ goto put_device ;
529
528
530
529
mode_val =
531
530
devm_kcalloc (dev ,
532
531
NETXBIG_LED_MODE_NUM , sizeof (* mode_val ),
533
532
GFP_KERNEL );
534
533
if (!mode_val ) {
535
534
ret = - ENOMEM ;
536
- goto err_node_put ;
535
+ goto put_device ;
537
536
}
538
537
539
538
for (i = 0 ; i < NETXBIG_LED_MODE_NUM ; i ++ )
@@ -542,12 +541,12 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
542
541
ret = of_property_count_u32_elems (child , "mode-val" );
543
542
if (ret < 0 || ret % 2 ) {
544
543
ret = - EINVAL ;
545
- goto err_node_put ;
544
+ goto put_device ;
546
545
}
547
546
num_modes = ret / 2 ;
548
547
if (num_modes > NETXBIG_LED_MODE_NUM ) {
549
548
ret = - EINVAL ;
550
- goto err_node_put ;
549
+ goto put_device ;
551
550
}
552
551
553
552
for (i = 0 ; i < num_modes ; i ++ ) {
@@ -560,7 +559,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
560
559
"mode-val" , 2 * i + 1 , & val );
561
560
if (mode >= NETXBIG_LED_MODE_NUM ) {
562
561
ret = - EINVAL ;
563
- goto err_node_put ;
562
+ goto put_device ;
564
563
}
565
564
mode_val [mode ] = val ;
566
565
}
@@ -583,8 +582,6 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
583
582
584
583
return 0 ;
585
584
586
- err_node_put :
587
- of_node_put (child );
588
585
put_device :
589
586
put_device (gpio_ext_dev );
590
587
return ret ;
0 commit comments