@@ -338,7 +338,6 @@ static int of_platform_bus_create(struct device_node *bus,
338
338
struct device * parent , bool strict )
339
339
{
340
340
const struct of_dev_auxdata * auxdata ;
341
- struct device_node * child ;
342
341
struct platform_device * dev ;
343
342
const char * bus_id = NULL ;
344
343
void * platform_data = NULL ;
@@ -382,13 +381,11 @@ static int of_platform_bus_create(struct device_node *bus,
382
381
if (!dev || !of_match_node (matches , bus ))
383
382
return 0 ;
384
383
385
- for_each_child_of_node (bus , child ) {
384
+ for_each_child_of_node_scoped (bus , child ) {
386
385
pr_debug (" create child: %pOF\n" , child );
387
386
rc = of_platform_bus_create (child , matches , lookup , & dev -> dev , strict );
388
- if (rc ) {
389
- of_node_put (child );
387
+ if (rc )
390
388
break ;
391
- }
392
389
}
393
390
of_node_set_flag (bus , OF_POPULATED_BUS );
394
391
return rc ;
@@ -459,7 +456,6 @@ int of_platform_populate(struct device_node *root,
459
456
const struct of_dev_auxdata * lookup ,
460
457
struct device * parent )
461
458
{
462
- struct device_node * child ;
463
459
int rc = 0 ;
464
460
465
461
root = root ? of_node_get (root ) : of_find_node_by_path ("/" );
@@ -470,12 +466,10 @@ int of_platform_populate(struct device_node *root,
470
466
pr_debug (" starting at: %pOF\n" , root );
471
467
472
468
device_links_supplier_sync_state_pause ();
473
- for_each_child_of_node (root , child ) {
469
+ for_each_child_of_node_scoped (root , child ) {
474
470
rc = of_platform_bus_create (child , matches , lookup , parent , true);
475
- if (rc ) {
476
- of_node_put (child );
471
+ if (rc )
477
472
break ;
478
- }
479
473
}
480
474
device_links_supplier_sync_state_resume ();
481
475
0 commit comments