Skip to content

Commit

Permalink
leds: ns2: remove unneeded variable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Simon Guinot <[email protected]>
Cc: Simon Guinot <[email protected]>
Cc: Vincent Donnefort <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Linus Walleij <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
  • Loading branch information
elkablo authored and pavelmachek committed Sep 26, 2020
1 parent a4a469b commit 48b77cd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/leds/leds-ns2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 48b77cd

Please sign in to comment.