aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/ledtrig-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/ledtrig-gpio.c')
-rw-r--r--drivers/leds/ledtrig-gpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/leds/ledtrig-gpio.c b/drivers/leds/ledtrig-gpio.c
index ecc4bf3f37a9..f057c101b896 100644
--- a/drivers/leds/ledtrig-gpio.c
+++ b/drivers/leds/ledtrig-gpio.c
@@ -200,6 +200,7 @@ static void gpio_trig_activate(struct led_classdev *led)
200 gpio_data->led = led; 200 gpio_data->led = led;
201 led->trigger_data = gpio_data; 201 led->trigger_data = gpio_data;
202 INIT_WORK(&gpio_data->work, gpio_trig_work); 202 INIT_WORK(&gpio_data->work, gpio_trig_work);
203 led->activated = true;
203 204
204 return; 205 return;
205 206
@@ -217,7 +218,7 @@ static void gpio_trig_deactivate(struct led_classdev *led)
217{ 218{
218 struct gpio_trig_data *gpio_data = led->trigger_data; 219 struct gpio_trig_data *gpio_data = led->trigger_data;
219 220
220 if (gpio_data) { 221 if (led->activated) {
221 device_remove_file(led->dev, &dev_attr_gpio); 222 device_remove_file(led->dev, &dev_attr_gpio);
222 device_remove_file(led->dev, &dev_attr_inverted); 223 device_remove_file(led->dev, &dev_attr_inverted);
223 device_remove_file(led->dev, &dev_attr_desired_brightness); 224 device_remove_file(led->dev, &dev_attr_desired_brightness);
@@ -225,6 +226,7 @@ static void gpio_trig_deactivate(struct led_classdev *led)
225 if (gpio_data->gpio != 0) 226 if (gpio_data->gpio != 0)
226 free_irq(gpio_to_irq(gpio_data->gpio), led); 227 free_irq(gpio_to_irq(gpio_data->gpio), led);
227 kfree(gpio_data); 228 kfree(gpio_data);
229 led->activated = false;
228 } 230 }
229} 231}
230 232