[PATCH leds v2 46/50] leds: ns2: remove unneeded variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
Cc: Simon Guinot <simon.guinot@xxxxxxxxxxxx>
Cc: Simon Guinot <sguinot@xxxxxxxxx>
Cc: Vincent Donnefort <vdonnefort@xxxxxxxxx>
Cc: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
 drivers/leds/leds-ns2.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 9d9c9ff4dce61..e94bb8535f0a7 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);
-- 
2.26.2




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux