leds: ns2: remove unneeded variable

No need to use variable found, we can determine whether the mode was
found by comparing iterator variable to its limit.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Simon Guinot <simon.guinot@sequanux.org>
Cc: Simon Guinot <sguinot@lacie.com>
Cc: Vincent Donnefort <vdonnefort@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
Marek Behún 2020-09-18 00:33:34 +02:00 committed by Pavel Machek
parent a4a469b431
commit 48b77cdca5

View File

@ -71,16 +71,13 @@ static int ns2_led_get_mode(struct ns2_led *led, enum ns2_led_modes *mode)
static void ns2_led_set_mode(struct ns2_led *led, enum ns2_led_modes mode)
{
int i;
bool found = false;
unsigned long flags;
for (i = 0; i < led->num_modes; i++)
if (mode == led->modval[i].mode) {
found = true;
if (mode == led->modval[i].mode)
break;
}
if (!found)
if (i == led->num_modes)
return;
write_lock_irqsave(&led->rw_lock, flags);