cmd/gpio: fix not working 'gpio set' command
PATCH 1/1 cmd/gpio: fix not working 'gpio set' command
From: Hannes Schmelzer <[email protected]>
In commit 0ffe6ab521f900bcc765be8f2f31d2c2ba3f0a7e the abbreviation for the subcommand 'status' was introduced and breaks the 'gpio set' command.
The change runs a test on the first character of the subcommand only, this method does not apply since
status
set
are both beginning with the character 's'.
So we have to test at least two characters to be matched, otherwise the condition for "status" is always true.
---
cmd/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/gpio.c +1 -1
@@ -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_statusgpio_status ();
Signature · 1 line
1.9.1
PATCH 1/1 cmd/gpio: fix not working 'gpio set' command
Quoted 30 lines · Hannes Schmelzer
From: Hannes Schmelzer <[email protected]>
In commit
0ffe6ab521f900bcc765be8f2f31d2c2ba3f0a7ethe abbreviation for the subcommand 'status' was introduced and breaks the 'gpio set' command.The change runs a test on the first character of the subcommand only, this method does not apply since
status
setare both beginning with the character 's'.
So we have to test at least two characters to be matched, otherwise the condition for "status" is always true.
Signed-off-by Hannes Schmelzer <[email protected]>Signed-off-by Hannes Schmelzer <[email protected]>---
cmd/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)cmd/gpio.c +0
-0
cmd/gpio.c static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 147
Quoted 8 lines
cmd/gpio.c +1
-1@@ -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_statusgpio_status ();
We can drop this patch, since Simon sent a fix a few hours before.
http://patchwork.ozlabs.org/patch/582638/
Sorry for noise.
regards,
Hannes
PATCH 1/1 cmd/gpio: fix not working 'gpio set' command
In reply to Hannes SchmelzerHi Hannes,
Quoted 30 lines · Hannes Schmelzer
From: Hannes Schmelzer <[email protected]>
In commit
0ffe6ab521f900bcc765be8f2f31d2c2ba3f0a7ethe abbreviation for the subcommand 'status' was introduced and breaks the 'gpio set' command.The change runs a test on the first character of the subcommand only, this method does not apply since
status
setare both beginning with the character 's'.
So we have to test at least two characters to be matched, otherwise the condition for "status" is always true.
Signed-off-by Hannes Schmelzer <[email protected]>Signed-off-by Hannes Schmelzer <[email protected]>---
cmd/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)cmd/gpio.c +0
-0
cmd/gpio.c static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Quoted 9 lines
cmd/gpio.c +1
-2@@ -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_statusgpio_status (); --
Duplicated patch :)
See http://patchwork.ozlabs.org/patch/582638/
Regards,
Bin