* [PATCH] regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path
@ 2009-12-15 13:30 Lars-Peter Clausen
2009-12-15 13:41 ` Mark Brown
2009-12-15 14:39 ` Liam Girdwood
0 siblings, 2 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2009-12-15 13:30 UTC (permalink / raw)
To: lrg; +Cc: linux-kernel, Lars-Peter Clausen
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: Lars-Peter Clausen <lars@metafoo.de>
---
drivers/regulator/core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1af8df2..686ef27 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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;
--
1.5.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path
2009-12-15 13:30 [PATCH] regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path Lars-Peter Clausen
@ 2009-12-15 13:41 ` Mark Brown
2009-12-15 14:39 ` Liam Girdwood
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2009-12-15 13:41 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: lrg, linux-kernel
On Tue, Dec 15, 2009 at 02:30:01PM +0100, Lars-Peter Clausen wrote:
> 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: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path
2009-12-15 13:30 [PATCH] regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path Lars-Peter Clausen
2009-12-15 13:41 ` Mark Brown
@ 2009-12-15 14:39 ` Liam Girdwood
1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2009-12-15 14:39 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: linux-kernel
On Tue, 2009-12-15 at 14:30 +0100, Lars-Peter Clausen wrote:
> 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: Lars-Peter Clausen <lars@metafoo.de>
> ---
> drivers/regulator/core.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
Applied for 2.6.33.
Thanks
Liam
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-15 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 13:30 [PATCH] regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path Lars-Peter Clausen
2009-12-15 13:41 ` Mark Brown
2009-12-15 14:39 ` Liam Girdwood
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.