Skip to contentSkip to conversation

Use return value of cmd_usage

PATCH New Thomas Weber 3 participants 8 messages Nov 25, 2010 – Nov 27, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

v2 cover Use return value of cmd_usage

cmd_usage returns 1, so its return value can be used as return value.

Some functions ignore the return value of cmd_usage and return a "1" in the next line. These patches change these calls so that the return value of cmd_usage is used as return value.

*** BLURB HERE ***

Thomas Weber (3):
Common/cmd_nvedit: Use return value of cmd_usage
Gdsys: osd: Use return value of cmd_usage
Powerpc: cmd_ecctest: Use return value of cmd_usage

 arch/powerpc/cpu/ppc4xx/cmd_ecctest.c |    6 ++----
 board/gdsys/common/osd.c              |    6 ++----
 common/cmd_nvedit.c                   |   18 ++++++------------
 3 files changed, 10 insertions(+), 20 deletions(-)
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH v2 1/3 common/cmd_nvedit: Use return value of cmd_usage

Use the return value of cmd_usage instead of ignoring this and returning a 1.

---
 common/cmd_nvedit.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
common/cmd_nvedit.c +6 -12
index 3fd8abc..cd19cc6 100644
@@ -545,8 +545,7 @@ int envmatch (uchar *s1, int i2)
 static int do_env_default(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
 	if ((argc != 2) || (strcmp(argv[1], "-f") != 0)) {
-		cmd_usage(cmdtp);
-		return 1;
+		return cmd_usage(cmdtp);
 	}
 	set_default_env("## Resetting to default environment\n");
 	return 0;
@@ -633,15 +632,13 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
 				sep = '\n';
 				break;
 			default:
-				cmd_usage(cmdtp);
-				return 1;
+				return cmd_usage(cmdtp);
 			}
 		}
 	}
 
 	if (argc < 1) {
-		cmd_usage(cmdtp);
-		return 1;
+		return cmd_usage(cmdtp);
 	}
 
 	addr = (char *)simple_strtoul(argv[0], NULL, 16);
@@ -744,15 +741,13 @@ static int do_env_import(cmd_tbl_t * cmdtp, int flag, int argc, char * const arg
 				del = 1;
 				break;
 			default:
-				cmd_usage(cmdtp);
-				return 1;
+				return cmd_usage(cmdtp);
 			}
 		}
 	}
 
 	if (argc < 1) {
-		cmd_usage(cmdtp);
-		return 1;
+		return cmd_usage(cmdtp);
 	}
 
 	if (!fmt)
@@ -857,8 +852,7 @@ static int do_env (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (cp)
 		return cp->cmd(cmdtp, flag, argc, argv);
 
-	cmd_usage(cmdtp);
-	return 1;
+	return cmd_usage(cmdtp);
 }
 
 U_BOOT_CMD(
Signature · 1 line
1.7.3.2
#2 lore raw

PATCH v2 1/3 common/cmd_nvedit: Use return value of cmd_usage

Dear Thomas Weber,

Quoted 7 lines · In message <[email protected]> you wrote:

Use the return value of cmd_usage instead of ignoring this and returning a 1.

---
 common/cmd_nvedit.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 9 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Fantasy is like alcohol - too much is bad for you, a little bit makes
the world a better place. Like  an  exercise  bicycle  it  takes  you
nowhere, but it just might tone up the muscles that will. Daydreaming
got  us  where we are today; early in our evolution we learned to let
our minds wander so well that they started coming  back  with  souve-
nirs.   - Terry Pratchett & Stephen Briggs, _The Discworld Companion_
#3 lore raw

PATCH v2 2/3 gdsys: osd: Use return value of cmd_usage

In reply to Thomas Weber

Use the return value of cmd_usage instead of ignoring this and returning a 1.

---
 board/gdsys/common/osd.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
board/gdsys/common/osd.c +2 -4
index 05800ff..239c870 100644
@@ -142,8 +142,7 @@ static int osd_print(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *text;
 
 	if (argc < 5) {
-		cmd_usage(cmdtp);
-		return 1;
+		return cmd_usage(cmdtp);
 	}
 
 	x = simple_strtoul(argv[1], NULL, 16);
@@ -204,8 +203,7 @@ int osd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	unsigned count = (argc > 4) ?  simple_strtoul(argv[4], NULL, 16) : 1;
 
 	if ((argc < 4) || (strlen(argv[3]) % 4)) {
-		cmd_usage(cmdtp);
-		return 1;
+		return cmd_usage(cmdtp);
 	}
 
 	x = simple_strtoul(argv[1], NULL, 16);
Signature · 1 line
1.7.3.2
#4 lore raw

PATCH v2 2/3 gdsys: osd: Use return value of cmd_usage

Dear Thomas Weber,

Quoted 7 lines · In message <[email protected]> you wrote:

Use the return value of cmd_usage instead of ignoring this and returning a 1.

---
 board/gdsys/common/osd.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Overdrawn?  But I still have checks left!
#5 lore raw

PATCH v2 3/3 powerpc: cmd_ecctest: Use return value of cmd_usage

In reply to Thomas Weber

Use the return value of cmd_usage instead of ignoring this and returning a 1.

---
 arch/powerpc/cpu/ppc4xx/cmd_ecctest.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/cpu/ppc4xx/cmd_ecctest.c +2 -4
index fd81b70..542ab69 100644
@@ -190,15 +190,13 @@ static int do_ecctest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int error;
 
 	if (argc < 3) {
-		cmd_usage(cmdtp);
-		return 1;
+		return cmd_usage(cmdtp);
 	}
 
 	ptr = (u32 *)simple_strtoul(argv[1], NULL, 16);
 	error = simple_strtoul(argv[2], NULL, 16);
 	if ((error < 1) || (error > 2)) {
-		cmd_usage(cmdtp);
-		return 1;
+		return cmd_usage(cmdtp);
 	}
 
 	printf("Using address %p for %d bit ECC error injection\n",
Signature · 1 line
1.7.3.2
#6 lore raw

PATCH v2 3/3 powerpc: cmd_ecctest: Use return value of cmd_usage

Dear Thomas Weber,

Quoted 7 lines · In message <[email protected]> you wrote:

Use the return value of cmd_usage instead of ignoring this and returning a 1.

---
 arch/powerpc/cpu/ppc4xx/cmd_ecctest.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I mean, I . . . think to understand you, I just don't know  what  you
are saying ...                        - Terry Pratchett, _Soul Music_
#7 lore raw

v2 cover Use return value of cmd_usage

In reply to Thomas Weber
Quoted 5 lines · On Thursday, November 25, 2010 02:05:27 Thomas Weber wrote:

cmd_usage returns 1, so its return value can be used as return value.

Some functions ignore the return value of cmd_usage and return a "1" in the next line. These patches change these calls so that the return value of cmd_usage is used as return value.

thanks, these all look sane to me

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101125/128f84de/attachment.pgp