[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1544434201-14190-2-git-send-email-krzk@kernel.org>
Date: Mon, 10 Dec 2018 10:29:57 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Jacek Anaszewski <jacek.anaszewski@...il.com>,
Pavel Machek <pavel@....cz>, Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Baolin Wang <baolin.wang@...aro.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 1/5] led: triggers: Break the for loop after default trigger is found
From: Jacek Anaszewski <jacek.anaszewski@...il.com>
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@...il.com>
Acked-by: Pavel Machek <pavel@....cz>
Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
---
drivers/leds/led-triggers.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 17d73db1456e..52b12e601ebe 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -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);
--
2.7.4
Powered by blists - more mailing lists