From: Hannes Schmelzer Date: Mon, 15 Feb 2016 12:04:06 +0100 Subject: [U-Boot] [PATCH] cmd/gpio: fix not working 'gpio set' command In-Reply-To: <1455519025-28672-1-git-send-email-oe5hpm@oevsv.at> References: <1455519025-28672-1-git-send-email-oe5hpm@oevsv.at> Message-ID: <56C1B0A6.20207@schmelzer.or.at> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 15.02.2016 07:50, Hannes Schmelzer wrote: > From: Hannes Schmelzer > > 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. > > Signed-off-by: Hannes Schmelzer > > Signed-off-by: Hannes Schmelzer > --- > > cmd/gpio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/cmd/gpio.c b/cmd/gpio.c > index 2b78b16..693998e 100644 > --- a/cmd/gpio.c > +++ b/cmd/gpio.c > @@ -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(); 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