@@ -296,13 +296,11 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start,
296296 if (!bus )
297297 return - EINVAL ;
298298
299- error = klist_iter_init_node (& bus -> p -> klist_devices , & i ,
300- (start ? & start -> p -> knode_bus : NULL ));
301- if (!error ) {
302- while ((dev = next_device (& i )) && !error )
303- error = fn (dev , data );
304- klist_iter_exit (& i );
305- }
299+ klist_iter_init_node (& bus -> p -> klist_devices , & i ,
300+ (start ? & start -> p -> knode_bus : NULL ));
301+ while ((dev = next_device (& i )) && !error )
302+ error = fn (dev , data );
303+ klist_iter_exit (& i );
306304 return error ;
307305}
308306EXPORT_SYMBOL_GPL (bus_for_each_dev );
@@ -332,10 +330,8 @@ struct device *bus_find_device(struct bus_type *bus,
332330 if (!bus )
333331 return NULL ;
334332
335- if (klist_iter_init_node (& bus -> p -> klist_devices , & i ,
336- (start ? & start -> p -> knode_bus : NULL )) < 0 )
337- return NULL ;
338-
333+ klist_iter_init_node (& bus -> p -> klist_devices , & i ,
334+ (start ? & start -> p -> knode_bus : NULL ));
339335 while ((dev = next_device (& i )))
340336 if (match (dev , data ) && get_device (dev ))
341337 break ;
@@ -388,9 +384,7 @@ struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id
388384 return NULL ;
389385
390386 if (hint ) {
391- if (klist_iter_init_node (& subsys -> p -> klist_devices , & i ,
392- & hint -> p -> knode_bus ) < 0 )
393- return NULL ;
387+ klist_iter_init_node (& subsys -> p -> klist_devices , & i , & hint -> p -> knode_bus );
394388 dev = next_device (& i );
395389 if (dev && dev -> id == id && get_device (dev )) {
396390 klist_iter_exit (& i );
@@ -452,13 +446,11 @@ int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
452446 if (!bus )
453447 return - EINVAL ;
454448
455- error = klist_iter_init_node (& bus -> p -> klist_drivers , & i ,
456- start ? & start -> p -> knode_bus : NULL );
457- if (!error ) {
458- while ((drv = next_driver (& i )) && !error )
459- error = fn (drv , data );
460- klist_iter_exit (& i );
461- }
449+ klist_iter_init_node (& bus -> p -> klist_drivers , & i ,
450+ start ? & start -> p -> knode_bus : NULL );
451+ while ((drv = next_driver (& i )) && !error )
452+ error = fn (drv , data );
453+ klist_iter_exit (& i );
462454 return error ;
463455}
464456EXPORT_SYMBOL_GPL (bus_for_each_drv );
@@ -1119,19 +1111,15 @@ EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
11191111 * otherwise if it is NULL, the iteration starts at the beginning of
11201112 * the list.
11211113 */
1122- int subsys_dev_iter_init (struct subsys_dev_iter * iter , struct bus_type * subsys ,
1123- struct device * start , const struct device_type * type )
1114+ void subsys_dev_iter_init (struct subsys_dev_iter * iter , struct bus_type * subsys ,
1115+ struct device * start , const struct device_type * type )
11241116{
11251117 struct klist_node * start_knode = NULL ;
1126- int error ;
11271118
11281119 if (start )
11291120 start_knode = & start -> p -> knode_bus ;
1130- error = klist_iter_init_node (& subsys -> p -> klist_devices , & iter -> ki ,
1131- start_knode );
1132- if (!error )
1133- iter -> type = type ;
1134- return error ;
1121+ klist_iter_init_node (& subsys -> p -> klist_devices , & iter -> ki , start_knode );
1122+ iter -> type = type ;
11351123}
11361124EXPORT_SYMBOL_GPL (subsys_dev_iter_init );
11371125
0 commit comments