Skip to content

Commit

Permalink
led: triggers: Break the for loop after default trigger is found
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
  • Loading branch information
jacek-anaszewski committed Dec 10, 2018
1 parent cb14e6d commit c4f7bd4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/leds/led-triggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ void led_trigger_set_default(struct led_classdev *led_cdev)
down_read(&triggers_list_lock);
down_write(&led_cdev->trigger_lock);
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);
break;
}
}
up_write(&led_cdev->trigger_lock);
up_read(&triggers_list_lock);
Expand Down

0 comments on commit c4f7bd4

Please sign in to comment.