linux-3.8: backport a leds-gpio.c crash fix (fixes #13721)
authorFelix Fietkau <nbd@openwrt.org>
Tue, 18 Jun 2013 22:23:38 +0000 (22:23 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 18 Jun 2013 22:23:38 +0000 (22:23 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 36968

target/linux/generic/patches-3.8/040-backport_led_gpio_request_fix.patch [new file with mode: 0644]

diff --git a/target/linux/generic/patches-3.8/040-backport_led_gpio_request_fix.patch b/target/linux/generic/patches-3.8/040-backport_led_gpio_request_fix.patch
new file mode 100644 (file)
index 0000000..b00d813
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/drivers/leds/leds-gpio.c
++++ b/drivers/leds/leds-gpio.c
+@@ -107,6 +107,10 @@ static int create_gpio_led(const struct 
+               return 0;
+       }
++      ret = devm_gpio_request(parent, template->gpio, template->name);
++      if (ret < 0)
++              return ret;
++
+       led_dat->cdev.name = template->name;
+       led_dat->cdev.default_trigger = template->default_trigger;
+       led_dat->gpio = template->gpio;
+@@ -126,10 +130,7 @@ static int create_gpio_led(const struct 
+       if (!template->retain_state_suspended)
+               led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
+-      ret = devm_gpio_request_one(parent, template->gpio,
+-                                  (led_dat->active_low ^ state) ?
+-                                  GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
+-                                  template->name);
++      ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state);
+       if (ret < 0)
+               return ret;