If static allocation and dynamic allocation GPIOs are present, dynamic allocation pollutes the numberspace for static allocation, causing static allocation to fail. Enfore dynamic allocation above GPIO_DYNAMIC_BASE. Seen on a GTA04 when omap-gpio (static) and twl-gpio (dynamic) raced. On that device it is fixed invasively by commit 92bf78b33b0b4 ("gpio: omap: use dynamic allocation of base") but lets also fix that for devices where there is still a mixture of static and dynamic allocation. Fixes: 7b61212f2a07 ("gpiolib: Get rid of ARCH_NR_GPIOS") Suggested-by: andy.shevchenko@xxxxxxxxx Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx> --- drivers/gpio/gpiolib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 19bd23044b017..18b68d0aec7db 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -188,6 +188,10 @@ static int gpiochip_find_base(int ngpio) int base = GPIO_DYNAMIC_BASE; list_for_each_entry(gdev, &gpio_devices, list) { + /* do not pollute area for static allocation */ + if (gdev->base < GPIO_DYNAMIC_BASE) + continue; + /* found a free space? */ if (gdev->base >= base + ngpio) break; -- 2.39.2