summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2020-09-18 00:33:34 +0200
committerPavel Machek <pavel@ucw.cz>2020-09-26 21:56:42 +0200
commit48b77cdca50a180fd1f22f4ae3b3d1e4ec7d2e5c (patch)
tree75df45753a6b0ce289d68613a637010ebd8d5506 /drivers/leds
parenta4a469b4314e95818521daef82aa7f9071123245 (diff)
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>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-ns2.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 9d9c9ff4dce6..e94bb8535f0a 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -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);