Commit c4f7bd4a authored by Jacek Anaszewski's avatar Jacek Anaszewski

led: triggers: Break the for loop after default trigger is found

It is of no avail to continue iterating through registered
triggers in the led_trigger_set_default() after the trigger to set
has been found. Add "break" statement to fix this omission.
Signed-off-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
parent cb14e6d6
...@@ -200,8 +200,10 @@ void led_trigger_set_default(struct led_classdev *led_cdev) ...@@ -200,8 +200,10 @@ void led_trigger_set_default(struct led_classdev *led_cdev)
down_read(&triggers_list_lock); down_read(&triggers_list_lock);
down_write(&led_cdev->trigger_lock); down_write(&led_cdev->trigger_lock);
list_for_each_entry(trig, &trigger_list, next_trig) { list_for_each_entry(trig, &trigger_list, next_trig) {
if (!strcmp(led_cdev->default_trigger, trig->name)) if (!strcmp(led_cdev->default_trigger, trig->name)) {
led_trigger_set(led_cdev, trig); led_trigger_set(led_cdev, trig);
break;
}
} }
up_write(&led_cdev->trigger_lock); up_write(&led_cdev->trigger_lock);
up_read(&triggers_list_lock); up_read(&triggers_list_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment