Patchwork [U-Boot,PATCHv2,1/3] common/cmd_nvedit: Use return value of cmd_usage

login
register
mail settings
Submitter Thomas Weber
Date Nov. 25, 2010, 7:05 a.m.
Message ID <1290668730-26595-2-git-send-email-weber@corscience.de>
Download mbox | patch
Permalink /patch/72990/
State Accepted
Commit 0d302af0bb7e0be40d960bd2d8ee0a91dc9e2bbf
Headers show

Comments

Thomas Weber - Nov. 25, 2010, 7:05 a.m.
Use the return value of cmd_usage instead of ignoring this
and returning a 1.

Signed-off-by: Thomas Weber <weber@corscience.de>
---
 common/cmd_nvedit.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
Wolfgang Denk - Nov. 27, 2010, 10:19 p.m.
Dear Thomas Weber,

In message <1290668730-26595-2-git-send-email-weber@corscience.de> you wrote:
> Use the return value of cmd_usage instead of ignoring this
> and returning a 1.
> 
> Signed-off-by: Thomas Weber <weber@corscience.de>
> ---
>  common/cmd_nvedit.c |   18 ++++++------------
>  1 files changed, 6 insertions(+), 12 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3fd8abc..cd19cc6 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -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(