summaryrefslogtreecommitdiff
path: root/drivers/base/driver.c
diff options
context:
space:
mode:
authorGimcuan Hui <gimcuan@gmail.com>2017-11-11 08:52:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-18 18:47:27 +0300
commit93ead7c9483c6d7ae0f67ae6d0a5d3966d84bec8 (patch)
treeaa5df925bfd023273f4d5de96dfbb20cd405239f /drivers/base/driver.c
parent73cf7e111ed69d8e1b59a3ae41b14bc77215e9ee (diff)
downloadlinux-93ead7c9483c6d7ae0f67ae6d0a5d3966d84bec8.tar.xz
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>
Diffstat (limited to 'drivers/base/driver.c')
-rw-r--r--drivers/base/driver.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 4e20d68edb0d..ba912558a510 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -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;