summaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorGimcuan Hui <gimcuan@gmail.com>2017-11-11 05:52:54 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-18 16:47:27 +0100
commit93ead7c9483c6d7ae0f67ae6d0a5d3966d84bec8 (patch)
treeaa5df925bfd023273f4d5de96dfbb20cd405239f /drivers/base/core.c
parent73cf7e111ed69d8e1b59a3ae41b14bc77215e9ee (diff)
downloadtalos-obmc-linux-93ead7c9483c6d7ae0f67ae6d0a5d3966d84bec8.tar.gz
talos-obmc-linux-93ead7c9483c6d7ae0f67ae6d0a5d3966d84bec8.zip
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/core.c')
-rw-r--r--drivers/base/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bf45587bcb46..61515ef91184 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2114,7 +2114,7 @@ int device_for_each_child(struct device *parent, void *data,
return 0;
klist_iter_init(&parent->p->klist_children, &i);
- while ((child = next_device(&i)) && !error)
+ while (!error && (child = next_device(&i)))
error = fn(child, data);
klist_iter_exit(&i);
return error;
OpenPOWER on IntegriCloud