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: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
This commit is contained in:
Jacek Anaszewski 2018-12-10 10:29:57 +01:00
parent cb14e6d6d8
commit c4f7bd4a42
1 changed files with 3 additions and 1 deletions

View File

@ -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);