treewide: gpio-export: add error handling
[openwrt/staging/wigyori.git] / target / linux / lantiq / patches-4.14 / 0030-GPIO-add-named-gpio-exports.patch
index 30b6a11818ba25570411dd318cf300d847a3d8e3..013d802265026d24df7361b81f2971fe8ff4b379 100644 (file)
@@ -22,7 +22,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
  #include "gpiolib.h"
  
-@@ -506,3 +508,73 @@ void of_gpiochip_remove(struct gpio_chip
+@@ -506,3 +508,75 @@ void of_gpiochip_remove(struct gpio_chip
        gpiochip_remove_pin_ranges(chip);
        of_node_put(chip->of_node);
  }
@@ -58,6 +58,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +                      enum of_gpio_flags of_flags;
 +
 +                      gpio = of_get_gpio_flags(cnp, i, &of_flags);
++                      if (!gpio_is_valid(gpio))
++                              return gpio;
 +
 +                      if (of_flags == OF_GPIO_ACTIVE_LOW)
 +                              flags |= GPIOF_ACTIVE_LOW;