diff options
author | Wolfgang Denk <wd@denx.de> | 2010-07-17 01:06:04 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-07-24 20:43:57 +0200 |
commit | 47e26b1bf91ddef69f4a3892815c857db094cef9 (patch) | |
tree | 7d688085d23779707c637703273f79bd3cca83e0 /common/cmd_onenand.c | |
parent | debb6299ac1180a08f29f88c6d782b21a9c98707 (diff) | |
download | u-boot-imx-47e26b1bf91ddef69f4a3892815c857db094cef9.zip u-boot-imx-47e26b1bf91ddef69f4a3892815c857db094cef9.tar.gz u-boot-imx-47e26b1bf91ddef69f4a3892815c857db094cef9.tar.bz2 |
cmd_usage(): simplify return code handling
Lots of code use this construct:
cmd_usage(cmdtp);
return 1;
Change cmd_usage() let it return 1 - then we can replace all these
ocurrances by
return cmd_usage(cmdtp);
This fixes a few places with incorrect return code handling, too.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'common/cmd_onenand.c')
-rw-r--r-- | common/cmd_onenand.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c index a3e46a3..83d967b 100644 --- a/common/cmd_onenand.c +++ b/common/cmd_onenand.c @@ -361,10 +361,7 @@ static int do_onenand_read(cmd_tbl_t * cmdtp, int flag, int argc, char * const a size_t retlen = 0; if (argc < 3) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); s = strchr(argv[0], '.'); if ((s != NULL) && (!strcmp(s, ".oob"))) @@ -391,10 +388,7 @@ static int do_onenand_write(cmd_tbl_t * cmdtp, int flag, int argc, char * const size_t retlen = 0; if (argc < 3) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); addr = (ulong)simple_strtoul(argv[1], NULL, 16); @@ -477,10 +471,7 @@ static int do_onenand_dump(cmd_tbl_t * cmdtp, int flag, int argc, char * const a char *s; if (argc < 2) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); s = strchr(argv[0], '.'); ofs = (int)simple_strtoul(argv[1], NULL, 16); @@ -502,10 +493,7 @@ static int do_onenand_markbad(cmd_tbl_t * cmdtp, int flag, int argc, char * cons argv += 2; if (argc <= 0) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); while (argc > 0) { addr = simple_strtoul(*argv, NULL, 16); @@ -549,12 +537,10 @@ static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[] c = find_cmd_tbl(argv[0], &cmd_onenand_sub[0], ARRAY_SIZE(cmd_onenand_sub)); - if (c) { - return c->cmd(cmdtp, flag, argc, argv); - } else { - cmd_usage(cmdtp); - return 1; - } + if (c) + return c->cmd(cmdtp, flag, argc, argv); + else + return cmd_usage(cmdtp); } U_BOOT_CMD( |