[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181209185847.GB6331@amd>
Date: Sun, 9 Dec 2018 19:58:47 +0100
From: Pavel Machek <pavel@....cz>
To: Jacek Anaszewski <jacek.anaszewski@...il.com>
Cc: linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
krzk@...nel.org
Subject: Re: [PATCH 1/2] led: triggers: Break the for loop after default
trigger is found
On Sun 2018-12-09 19:49:41, Jacek Anaszewski wrote:
> 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>
> 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);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists