drivers: base: omit redundant interations

When error happens, these interators return the error, no interation should
be continued, so make the change for getting out of while immediately.

Signed-off-by: Gimcuan Hui <gimcuan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Gimcuan Hui
2017-11-11 05:52:54 +00:00
gecommit door Greg Kroah-Hartman
bovenliggende 73cf7e111e
commit 93ead7c948
3 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen

Bestand weergeven

@@ -50,7 +50,7 @@ int driver_for_each_device(struct device_driver *drv, struct device *start,
klist_iter_init_node(&drv->p->klist_devices, &i,
start ? &start->p->knode_driver : NULL);
while ((dev = next_device(&i)) && !error)
while (!error && (dev = next_device(&i)))
error = fn(dev, data);
klist_iter_exit(&i);
return error;