2013-04-13 14:47:29

by jonghwan Choi

[permalink] [raw]
Subject: [PATCH 3.8-stable] gpio: fix wrong checking condition for gpio range

From: Haojian Zhuang <[email protected]>

This patch looks like it should be in the 3.8-stable tree, should we apply
it?

------------------

From: "Haojian Zhuang <[email protected]>"

commit ad4e1a7caf937ad395ced585ca85a7d14395dc80 upstream

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 <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Jonghwan Choi <[email protected]>
---
drivers/gpio/gpiolib-of.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index d542a14..ea537fa 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -228,7 +228,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)
@@ -257,8 +257,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)

if (ret)
break;
-
- } while (index++);
+ }
}

#else
--
1.7.10.4


2013-04-13 15:26:40

by Haojian Zhuang

[permalink] [raw]
Subject: Re: [PATCH 3.8-stable] gpio: fix wrong checking condition for gpio range

On 13 April 2013 22:46, Jonghwan Choi <[email protected]> wrote:
> From: Haojian Zhuang <[email protected]>
>
> This patch looks like it should be in the 3.8-stable tree, should we apply
> it?
>

It could be merged into 3.8-stable tree.

Regards
Haojian

2013-04-15 00:21:55

by Jonghwan Choi

[permalink] [raw]
Subject: RE: [PATCH 3.8-stable] gpio: fix wrong checking condition for gpio range

Dear Haojian Ahuang.

> > This patch looks like it should be in the 3.8-stable tree, should we
> apply
> > it?
> >
>
> It could be merged into 3.8-stable tree.
>

Thanks~

Best Regards.

> -----Original Message-----
> From: Haojian Zhuang [mailto:[email protected]]
> Sent: Sunday, April 14, 2013 12:27 AM
> To: Jonghwan Choi
> Cc: Linus Walleij; [email protected]; [email protected];
> Jonghwan Choi
> Subject: Re: [PATCH 3.8-stable] gpio: fix wrong checking condition for
> gpio range
>
> On 13 April 2013 22:46, Jonghwan Choi <[email protected]> wrote:
> > From: Haojian Zhuang <[email protected]>
> >
> > This patch looks like it should be in the 3.8-stable tree, should we
> apply
> > it?
> >
>
> It could be merged into 3.8-stable tree.
>
> Regards
> Haojian