提交 eb143ac1 编写于 作者: L Lars-Peter Clausen 提交者: Liam Girdwood

regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path

Currently it is possible for regulator_bulk_{enable,disable} operations to
generate unbalanced regulator_{disable,enable} calls in its error path.
In case of an error only those regulators of the bulk operation which actually
had been enabled/disabled should get their original state restored.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Acked-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: NLiam Girdwood <lrg@slimlogic.co.uk>
上级 fa2984d4
......@@ -1977,7 +1977,7 @@ int regulator_bulk_enable(int num_consumers,
err:
printk(KERN_ERR "Failed to enable %s: %d\n", consumers[i].supply, ret);
for (i = 0; i < num_consumers; i++)
for (--i; i >= 0; --i)
regulator_disable(consumers[i].consumer);
return ret;
......@@ -2013,7 +2013,7 @@ int regulator_bulk_disable(int num_consumers,
err:
printk(KERN_ERR "Failed to disable %s: %d\n", consumers[i].supply,
ret);
for (i = 0; i < num_consumers; i++)
for (--i; i >= 0; --i)
regulator_enable(consumers[i].consumer);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册