diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-07-16 22:51:14 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2008-07-23 09:49:56 +0100 |
commit | fe3025b55c8ed06929afe94e9c9095fc19d15aa0 (patch) | |
tree | aad95bb0d04d0305f265ca1ecf442f091114a98a | |
parent | f46e9203d9a100bae216cc06e17f2e77351aa8d8 (diff) | |
download | lwn-fe3025b55c8ed06929afe94e9c9095fc19d15aa0.tar.gz lwn-fe3025b55c8ed06929afe94e9c9095fc19d15aa0.zip |
leds: Ensure led->trigger is set earlier
Make sure led->trigger is valid before calling trigger->activate
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
-rw-r--r-- | drivers/leds/led-triggers.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 0f242b3f09b6..f910eaffe3a6 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -111,16 +111,17 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger) flags); if (led_cdev->trigger->deactivate) led_cdev->trigger->deactivate(led_cdev); + led_cdev->trigger = NULL; led_set_brightness(led_cdev, LED_OFF); } if (trigger) { write_lock_irqsave(&trigger->leddev_list_lock, flags); list_add_tail(&led_cdev->trig_list, &trigger->led_cdevs); write_unlock_irqrestore(&trigger->leddev_list_lock, flags); + led_cdev->trigger = trigger; if (trigger->activate) trigger->activate(led_cdev); } - led_cdev->trigger = trigger; } EXPORT_SYMBOL_GPL(led_trigger_set); |