diff mbox

[03/12] regulator: gpio-regulator: Fix logical error in for() loop

Message ID 1355129761-8088-4-git-send-email-lee.jones@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Lee Jones Dec. 10, 2012, 8:55 a.m. UTC
The cond-statement of this particular for() loop will always be
true as long as at least one voltage-shifting GPIO is present.
If it wasn't for the break below, we'd be stuck in a forever loop.
This patch inserts the correct cond-statement into the statement.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/regulator/gpio-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Dec. 10, 2012, 2:12 p.m. UTC | #1
On Mon, Dec 10, 2012 at 08:55:52AM +0000, Lee Jones wrote:
> The cond-statement of this particular for() loop will always be
> true as long as at least one voltage-shifting GPIO is present.
> If it wasn't for the break below, we'd be stuck in a forever loop.
> This patch inserts the correct cond-statement into the statement.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 3afa46a..5462c28 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -181,7 +181,7 @@  of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
 	if (!config->gpios)
 		return ERR_PTR(-ENOMEM);
 
-	for (i = 0; config->nr_gpios; i++) {
+	for (i = 0; i < config->nr_gpios; i++) {
 		gpio = of_get_named_gpio(np, "gpios", i);
 		if (gpio < 0)
 			break;