[PATCH 12/32] commands: trigger: drop unused variable

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Sep 5 02:55:37 PDT 2022


Static analyzer correctly identifies led as being set, but always
overwritten later on. As the later assignments all have their own
argument count check, so we can just drop the first assignment.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 commands/trigger.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/commands/trigger.c b/commands/trigger.c
index c1402b66f049..d2802080b96f 100644
--- a/commands/trigger.c
+++ b/commands/trigger.c
@@ -16,7 +16,7 @@
 
 static int do_trigger(int argc, char *argv[])
 {
-	struct led *led = NULL;
+	struct led *led;
 	int opt, ret = 0;
 	int cmd = LED_COMMAND_SHOW_INFO;
 	enum led_trigger trigger;
@@ -35,9 +35,6 @@ static int do_trigger(int argc, char *argv[])
 		}
 	}
 
-	if (optind < argc)
-		led = led_by_name_or_number(argv[optind]);
-
 	switch (cmd) {
 	case LED_COMMAND_SHOW_INFO:
 		led_triggers_show_info();
-- 
2.30.2




More information about the barebox mailing list