diff options
author | Jason Kridner <jkridner@beagleboard.org> | 2011-03-08 20:42:01 -0600 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2011-09-04 11:36:21 +0200 |
commit | 95492d784b6167a5de47f7aae691646e99f5b623 (patch) | |
tree | 241715485d7af10cc0dfe6c459faac7898c4b5df /common/cmd_led.c | |
parent | f4b36ea92710242e213f8eefff470423a0166eaa (diff) |
Corrected LED name match finding avoiding extraneous Usage printouts
Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Diffstat (limited to 'common/cmd_led.c')
-rw-r--r-- | common/cmd_led.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/cmd_led.c b/common/cmd_led.c index c53195f1a36..8b468486e0f 100644 --- a/common/cmd_led.c +++ b/common/cmd_led.c @@ -83,7 +83,7 @@ int str_onoff (char *var) int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - int state, i; + int state, i, match = 0; /* Validate arguments */ if ((argc != 3)) { @@ -98,6 +98,7 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) for (i = 0; led_commands[i].string; i++) { if ((strcmp("all", argv[1]) == 0) || (strcmp(led_commands[i].string, argv[1]) == 0)) { + match = 1; if (led_commands[i].on) { if (state) { led_commands[i].on(); @@ -112,7 +113,7 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } /* If we ran out of matches, print Usage */ - if (!led_commands[i].string && !(strcmp("all", argv[1]) == 0)) { + if (!match) { return cmd_usage(cmdtp); } |