diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index c7ee224bcb864951403a5482490e05235052eeef..4a36164843d9266530011751cdc805f23881b0b5 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2745,7 +2745,10 @@ static inline void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
  */
 int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_request(chip->gpiodev->base + offset);
+	if (!list_empty(&chip->gpiodev->pin_ranges))
+		return pinctrl_gpio_request(chip->gpiodev->base + offset);
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_request);