[PATCH] gpiolib: fix allocating dynamic gpio numbers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since f349b66267 the loop in gpiochip_find_base() counts downwards,
hence we must decrease i by the number of GPIOs in the current chip,
not increase them.

Fixes: f349b66267 ("gpio: allocate dynamic gpio numbers top down")
Reported-by: Alexander Shiyan <eagle.alexander923@xxxxxxxxx>
Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 10cb7b3895..f845a57394 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -431,7 +431,7 @@ static int gpiochip_find_base(int ngpio)
 			}
 		} else {
 			spare = 0;
-			i += chip->ngpio - 1;
+			i -= chip->ngpio - 1;
 		}
 	}
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux