]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
regulator: gpio-regulator: Fix logical error in for() loop
authorLee Jones <lee.jones@linaro.org>
Mon, 10 Dec 2012 08:55:52 +0000 (08:55 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 10 Dec 2012 14:12:41 +0000 (23:12 +0900)
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>
drivers/regulator/gpio-regulator.c

index 8c4e237394942441f809fd62546b67ff8e0901ca..84e585fca7952c50b5d7bbd976bf06f6e846b26f 100644 (file)
@@ -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;