[PATCH] gpiolib: fix allocating dynamic gpio numbers.
Sascha Hauer
s.hauer at pengutronix.de
Thu May 19 03:44:00 PDT 2022
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 at gmail.com>
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
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
More information about the barebox
mailing list