aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-gpio.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 8fa352ac20f8..102ef4a14c5f 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -78,6 +78,13 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
78{ 78{
79 int ret; 79 int ret;
80 80
81 /* skip leds that aren't available */
82 if (!gpio_is_valid(template->gpio)) {
83 printk(KERN_INFO "Skipping unavilable LED gpio %d (%s)\n",
84 template->gpio, template->name);
85 return;
86 }
87
81 ret = gpio_request(template->gpio, template->name); 88 ret = gpio_request(template->gpio, template->name);
82 if (ret < 0) 89 if (ret < 0)
83 return ret; 90 return ret;
@@ -114,6 +121,8 @@ err:
114 121
115static void delete_gpio_led(struct gpio_led_data *led) 122static void delete_gpio_led(struct gpio_led_data *led)
116{ 123{
124 if (!gpio_is_valid(led->gpio))
125 return;
117 led_classdev_unregister(&led->cdev); 126 led_classdev_unregister(&led->cdev);
118 cancel_work_sync(&led->work); 127 cancel_work_sync(&led->work);
119 gpio_free(led->gpio); 128 gpio_free(led->gpio);