Commit 95492d784b6167a5de47f7aae691646e99f5b623
Committed by
Albert ARIBAUD
1 parent
f4b36ea927
Exists in
master
and in
54 other branches
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>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
common/cmd_led.c
... | ... | @@ -83,7 +83,7 @@ |
83 | 83 | |
84 | 84 | int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
85 | 85 | { |
86 | - int state, i; | |
86 | + int state, i, match = 0; | |
87 | 87 | |
88 | 88 | /* Validate arguments */ |
89 | 89 | if ((argc != 3)) { |
... | ... | @@ -98,6 +98,7 @@ |
98 | 98 | for (i = 0; led_commands[i].string; i++) { |
99 | 99 | if ((strcmp("all", argv[1]) == 0) || |
100 | 100 | (strcmp(led_commands[i].string, argv[1]) == 0)) { |
101 | + match = 1; | |
101 | 102 | if (led_commands[i].on) { |
102 | 103 | if (state) { |
103 | 104 | led_commands[i].on(); |
... | ... | @@ -112,7 +113,7 @@ |
112 | 113 | } |
113 | 114 | |
114 | 115 | /* If we ran out of matches, print Usage */ |
115 | - if (!led_commands[i].string && !(strcmp("all", argv[1]) == 0)) { | |
116 | + if (!match) { | |
116 | 117 | return cmd_usage(cmdtp); |
117 | 118 | } |
118 | 119 |