gpio: Correct handling of 'gpio status'
authorSimon Glass <sjg@chromium.org>
Sun, 14 Feb 2016 23:28:59 +0000 (16:28 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 15 Feb 2016 20:58:25 +0000 (20:58 +0000)
This is broken - we need to look at the first two characters to distinguish
'gpio status' from 'gpio set'.

Fixes: 0ffe6ab5 (gpio: Allow 's' as an abbreviation for 'status')
Reported-by: Soeren Moch <smoch@web.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Soeren Moch <smoch@web.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>
cmd/gpio.c

index 2b78b168663e05dde9e70d0a15696db11079c4ac..693998e8bd5d14822504aa5806c8f9ad0f7f1010 100644 (file)
@@ -141,7 +141,7 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #endif
        if (argc > 0)
                str_gpio = *argv;
-       if (!strncmp(str_cmd, "status", 1)) {
+       if (!strncmp(str_cmd, "status", 2)) {
                /* Support deprecated gpio_status() */
 #ifdef gpio_status
                gpio_status();