Skip to content

Commit

Permalink
regulator: gpio-regulator: Fix logical error in for() loop
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Lee Jones authored and Mark Brown committed Dec 10, 2012
1 parent ec4f7b8 commit ad0b8b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/gpio-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,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;
Expand Down

0 comments on commit ad0b8b9

Please sign in to comment.