Skip to content

Commit

Permalink
gpio: fix wrong checking condition for gpio range
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Haojian Zhuang authored and Linus Walleij committed Mar 7, 2013
1 parent 6dbe51c commit ad4e1a7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/gpio/gpiolib-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -222,8 +222,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)

if (ret)
break;

} while (index++);
}
}

#else
Expand Down

0 comments on commit ad4e1a7

Please sign in to comment.