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>
This commit is contained in:
parent
f46e9203d9
commit
fe3025b55c
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue