From: Dmitry Baryshkov Date: Wed, 16 Jul 2008 21:51:14 +0000 (+0100) Subject: leds: Ensure led->trigger is set earlier X-Git-Tag: v2.6.27-rc1~521^2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=fe3025b55c8ed06929afe94e9c9095fc19d15aa0;p=linux-2.6-omap-h63xx.git leds: Ensure led->trigger is set earlier Make sure led->trigger is valid before calling trigger->activate Signed-off-by: Dmitry Baryshkov Signed-off-by: Andrew Morton Signed-off-by: Richard Purdie --- diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 0f242b3f09b..f910eaffe3a 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);