diff options
author | Haojian Zhuang <haojian.zhuang@linaro.org> | 2013-02-17 15:42:48 +0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-03-07 07:37:24 +0400 |
commit | ad4e1a7caf937ad395ced585ca85a7d14395dc80 (patch) | |
tree | cc24c9af0ac654084fe0e7daf903deb867d9fe4a /drivers/gpio | |
parent | 6dbe51c251a327e012439c4772097a13df43c5b8 (diff) | |
download | linux-ad4e1a7caf937ad395ced585ca85a7d14395dc80.tar.xz |
gpio: fix wrong checking condition for gpio range
If index++ calculates from 0, the checking condition of "while
(index++)" fails & it doesn't check any more. It doesn't follow
the loop that used at here.
Replace it by endless loop at here. Then it keeps parsing
"gpio-ranges" property until it ends.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a71a54a3e3f7..5150df6cba08 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -193,7 +193,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) if (!np) return; - do { + for (;; index++) { ret = of_parse_phandle_with_args(np, "gpio-ranges", "#gpio-range-cells", index, &pinspec); if (ret) @@ -222,8 +222,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) if (ret) break; - - } while (index++); + } } #else |