diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-02-04 02:16:17 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-02-04 13:37:24 +0300 |
commit | b8c77ff6902baa6ca93ca643bfff2d565801ea30 (patch) | |
tree | 188250c8309f186f697ebbebc14829da507cea9c /drivers/regulator | |
parent | a8bd42a97741aefa5942605fa87418fc8a6c4169 (diff) | |
download | linux-b8c77ff6902baa6ca93ca643bfff2d565801ea30.tar.xz |
regulator: core: simplify regulator_bulk_force_disable()
There is no need to have two loops there, we can store error for subsequent
reporting.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 206c274c0003..fe05923611ee 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3687,21 +3687,17 @@ int regulator_bulk_force_disable(int num_consumers, struct regulator_bulk_data *consumers) { int i; - int ret; + int ret = 0; - for (i = 0; i < num_consumers; i++) + for (i = 0; i < num_consumers; i++) { consumers[i].ret = regulator_force_disable(consumers[i].consumer); - for (i = 0; i < num_consumers; i++) { - if (consumers[i].ret != 0) { + /* Store first error for reporting */ + if (consumers[i].ret && !ret) ret = consumers[i].ret; - goto out; - } } - return 0; -out: return ret; } EXPORT_SYMBOL_GPL(regulator_bulk_force_disable); |