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>
diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index d01ee19..2bd62e2 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -84,10 +84,8 @@
addr = dis_last_addr;
len = dis_last_len;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command */
@@ -125,10 +123,8 @@
/* -------------------------------------------------- */
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
printf ("\nEnter '.' when done\n");
mem_addr = simple_strtoul (argv[1], NULL, 16);
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 5ec798c..d51cc55 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -102,8 +102,7 @@
addr = simple_strtoul(argv[1], NULL, 16);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return (bmp_info(addr));
@@ -127,8 +126,7 @@
y = simple_strtoul(argv[3], NULL, 10);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return (bmp_display(addr, x, y));
@@ -159,12 +157,10 @@
c = find_cmd_tbl(argv[0], &cmd_bmp_sub[0], ARRAY_SIZE(cmd_bmp_sub));
- if (c) {
+ if (c)
return c->cmd(cmdtp, flag, argc, argv);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index 9ccc8c7..72dacaa 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -40,10 +40,8 @@
ulong addr, rc;
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index bf77fb4..adfa6cd 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -491,17 +491,14 @@
argv++;
return bootm_start(cmdtp, flag, argc, argv);
}
- }
- /* Unrecognized command */
- else {
- cmd_usage(cmdtp);
- return 1;
+ } else {
+ /* Unrecognized command */
+ return cmd_usage(cmdtp);
}
if (images.state >= state) {
printf ("Trying to execute a command out of order\n");
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
images.state |= state;
diff --git a/common/cmd_cache.c b/common/cmd_cache.c
index be87b5c..5cdd834 100644
--- a/common/cmd_cache.c
+++ b/common/cmd_cache.c
@@ -34,10 +34,6 @@
switch (argc) {
case 2: /* on / off */
switch (on_off(argv[1])) {
-#if 0 /* prevented by varargs handling; FALLTROUGH is harmless, too */
- default: cmd_usage(cmdtp);
- return;
-#endif
case 0: icache_disable();
break;
case 1: icache_enable ();
@@ -49,8 +45,7 @@
icache_status() ? "ON" : "OFF");
return 0;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
}
@@ -60,10 +55,6 @@
switch (argc) {
case 2: /* on / off */
switch (on_off(argv[1])) {
-#if 0 /* prevented by varargs handling; FALLTROUGH is harmless, too */
- default: cmd_usage(cmdtp);
- return;
-#endif
case 0: dcache_disable();
break;
case 1: dcache_enable ();
@@ -75,8 +66,7 @@
dcache_status() ? "ON" : "OFF");
return 0;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c
index 45de8cd..45fe66a 100644
--- a/common/cmd_dcr.c
+++ b/common/cmd_dcr.c
@@ -44,10 +44,8 @@
unsigned long get_dcr (unsigned short);
/* Validate arguments */
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
/* Get a DCR */
dcrn = (unsigned short) simple_strtoul (argv[1], NULL, 16);
@@ -73,10 +71,8 @@
extern char console_buffer[];
/* Validate arguments */
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
/* Set a DCR */
dcrn = (unsigned short) simple_strtoul (argv[1], NULL, 16);
@@ -120,10 +116,8 @@
char buf[80];
/* Validate arguments */
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/* Find out whether ther is '.' (dot) symbol in the first parameter. */
strncpy (buf, argv[1], sizeof(buf)-1);
@@ -176,10 +170,8 @@
char buf[80];
/* Validate arguments */
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/* Find out whether ther is '.' (dot) symbol in the first parameter. */
strncpy (buf, argv[1], sizeof(buf)-1);
diff --git a/common/cmd_df.c b/common/cmd_df.c
index 6a08666..9a3c84c 100644
--- a/common/cmd_df.c
+++ b/common/cmd_df.c
@@ -27,8 +27,7 @@
}
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index 129162c..9f4b22c 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -104,8 +104,7 @@
}
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
#endif
diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index 49021cd..35fb361 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -65,10 +65,9 @@
block_dev_desc_t *dev_desc=NULL;
int part_length;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
+
dev = (int)simple_strtoul (argv[2], &ep, 16);
dev_desc = get_dev(argv[1],dev);
@@ -164,8 +163,7 @@
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!filename) {
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index 486d5d4..831a07f 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -741,8 +741,7 @@
boot_drive=simple_strtoul(argv[2], NULL, 10);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/* setup FDC and scan for drives */
if(fdc_setup(boot_drive,pCMD,pFG)==FALSE) {
diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c
index 00f7e88..a8822d9 100644
--- a/common/cmd_fdos.c
+++ b/common/cmd_fdos.c
@@ -73,8 +73,7 @@
name = argv [2];
break;
default:
- cmd_usage(cmdtp);
- break;
+ return cmd_usage(cmdtp);
}
/* Init physical layer */
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index cd4c6de..3d0c2b7 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -65,14 +65,12 @@
*/
int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
- /********************************************************************
+ /*
* Set the address of the fdt
- ********************************************************************/
+ */
if (argv[1][0] == 'a') {
unsigned long addr;
/*
@@ -116,18 +114,16 @@
}
}
- /********************************************************************
+ /*
* Move the working_fdt
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "mo", 2) == 0) {
struct fdt_header *newaddr;
int len;
int err;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/*
* Set the address and length of the fdt.
@@ -166,9 +162,9 @@
}
working_fdt = newaddr;
- /********************************************************************
+ /*
* Make a new node
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "mk", 2) == 0) {
char *pathp; /* path */
char *nodep; /* new node to add */
@@ -178,10 +174,8 @@
/*
* Parameters: Node path, new node to be appended to the path.
*/
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
pathp = argv[2];
nodep = argv[3];
@@ -202,9 +196,9 @@
return 1;
}
- /********************************************************************
+ /*
* Set the value of a property in the working_fdt.
- ********************************************************************/
+ */
} else if (argv[1][0] == 's') {
char *pathp; /* path */
char *prop; /* property */
@@ -216,10 +210,8 @@
/*
* Parameters: Node path, property, optional value.
*/
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
pathp = argv[2];
prop = argv[3];
@@ -247,9 +239,9 @@
return 1;
}
- /********************************************************************
+ /*
* Print (recursive) / List (single level)
- ********************************************************************/
+ */
} else if ((argv[1][0] == 'p') || (argv[1][0] == 'l')) {
int depth = MAX_LEVEL; /* how deep to print */
char *pathp; /* path */
@@ -281,9 +273,9 @@
if (ret != 0)
return ret;
- /********************************************************************
+ /*
* Remove a property/node
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "rm", 2) == 0) {
int nodeoffset; /* node offset from libfdt */
int err;
@@ -321,9 +313,9 @@
}
}
- /********************************************************************
+ /*
* Display header info
- ********************************************************************/
+ */
} else if (argv[1][0] == 'h') {
u32 version = fdt_version(working_fdt);
printf("magic:\t\t\t0x%x\n", fdt_magic(working_fdt));
@@ -351,16 +343,16 @@
fdt_num_mem_rsv(working_fdt));
printf("\n");
- /********************************************************************
+ /*
* Set boot cpu id
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "boo", 3) == 0) {
unsigned long tmp = simple_strtoul(argv[2], NULL, 16);
fdt_set_boot_cpuid_phys(working_fdt, tmp);
- /********************************************************************
+ /*
* memory command
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "me", 2) == 0) {
uint64_t addr, size;
int err;
@@ -370,9 +362,9 @@
if (err < 0)
return err;
- /********************************************************************
+ /*
* mem reserve commands
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "rs", 2) == 0) {
if (argv[2][0] == 'p') {
uint64_t addr, size;
@@ -417,8 +409,7 @@
}
} else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
}
#ifdef CONFIG_OF_BOARD_SETUP
@@ -430,10 +421,8 @@
else if (argv[1][0] == 'c') {
unsigned long initrd_start = 0, initrd_end = 0;
- if ((argc != 2) && (argc != 4)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc != 2) && (argc != 4))
+ return cmd_usage(cmdtp);
if (argc == 4) {
initrd_start = simple_strtoul(argv[2], NULL, 16);
@@ -449,8 +438,7 @@
}
else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index 5d8fb7a..ff43965 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -332,10 +332,8 @@
#endif
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "all") == 0) {
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
@@ -383,10 +381,8 @@
}
#endif
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "bank") == 0) {
bank = simple_strtoul(argv[2], NULL, 16);
@@ -406,10 +402,8 @@
return 1;
}
- if (addr_first >= addr_last) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (addr_first >= addr_last)
+ return cmd_usage(cmdtp);
rcode = flash_sect_erase(addr_first, addr_last);
return rcode;
@@ -482,19 +476,15 @@
int p;
int rcode = 0;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
- if (strcmp(argv[1], "off") == 0) {
+ if (strcmp(argv[1], "off") == 0)
p = 0;
- } else if (strcmp(argv[1], "on") == 0) {
+ else if (strcmp(argv[1], "on") == 0)
p = 1;
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
#ifdef CONFIG_HAS_DATAFLASH
if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) {
@@ -592,10 +582,8 @@
}
#endif
- if (argc != 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 4)
+ return cmd_usage(cmdtp);
if (strcmp(argv[2], "bank") == 0) {
bank = simple_strtoul(argv[3], NULL, 16);
@@ -634,10 +622,9 @@
return 1;
}
- if (addr_first >= addr_last) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (addr_first >= addr_last)
+ return cmd_usage(cmdtp);
+
rcode = flash_sect_protect (p, addr_first, addr_last);
#endif /* CONFIG_SYS_NO_FLASH */
return rcode;
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index ddc7a05..e50c9de 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -44,7 +44,6 @@
#endif
/* Local functions */
-static void fpga_usage (cmd_tbl_t * cmdtp);
static int fpga_get_op (char *opstr);
/* Local defines */
@@ -232,8 +231,7 @@
switch (op) {
case FPGA_NONE:
- fpga_usage (cmdtp);
- break;
+ return cmd_usage(cmdtp);
case FPGA_INFO:
rc = fpga_info (dev);
@@ -312,17 +310,11 @@
default:
printf ("Unknown operation\n");
- fpga_usage (cmdtp);
- break;
+ return cmd_usage(cmdtp);
}
return (rc);
}
-static void fpga_usage (cmd_tbl_t * cmdtp)
-{
- cmd_usage(cmdtp);
-}
-
/*
* Map op to supported operations. We don't use a table since we
* would just have to relocate it from flash anyway.
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index fb9d3b0..371e022 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -184,10 +184,8 @@
uint devaddr, alen, length;
u_char *memaddr;
- if (argc != 5) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 5)
+ return cmd_usage(cmdtp);
/*
* I2C chip address
@@ -200,10 +198,8 @@
*/
devaddr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Length is the number of objects, not number of bytes.
@@ -240,10 +236,8 @@
alen = i2c_dp_last_alen;
length = i2c_dp_last_length;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
/*
@@ -261,10 +255,8 @@
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* If another parameter, it is the length to display.
@@ -332,10 +324,8 @@
uchar byte;
int count;
- if ((argc < 4) || (argc > 5)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc < 4) || (argc > 5))
+ return cmd_usage(cmdtp);
/*
* Chip is always specified.
@@ -347,10 +337,8 @@
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Value to write is always specified.
@@ -398,10 +386,8 @@
ulong crc;
ulong err;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/*
* Chip is always specified.
@@ -413,10 +399,8 @@
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Count is always specified
@@ -462,10 +446,8 @@
int nbytes;
extern char console_buffer[];
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* got a good command to get here */
@@ -495,10 +477,8 @@
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
}
/*
@@ -628,10 +608,8 @@
u_char bytes[16];
int delay;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/*
* Chip is always specified.
@@ -643,10 +621,8 @@
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Length is the number of objects, not number of bytes.
@@ -784,10 +760,9 @@
"32 MiB", "16 MiB", "8 MiB", "4 MiB"
};
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
/*
* Chip is always specified.
*/
@@ -1322,12 +1297,10 @@
c = find_cmd_tbl(argv[0], &cmd_i2c_sub[0], ARRAY_SIZE(cmd_i2c_sub));
- if (c) {
+ if (c)
return c->cmd(cmdtp, flag, argc, argv);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
}
/***************************************************/
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index d486697..c0fb88d 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -179,8 +179,7 @@
switch (argc) {
case 0:
case 1:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 2:
if (strncmp(argv[1],"res",3) == 0) {
puts ("\nReset IDE"
@@ -229,8 +228,7 @@
}
return rcode;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1],"dev",3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
@@ -278,8 +276,7 @@
#endif
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default:
/* at least 4 args */
@@ -332,14 +329,12 @@
printf ("%ld blocks written: %s\n",
n, (n==cnt) ? "OK" : "ERROR");
- if (n==cnt) {
+ if (n==cnt)
return 0;
- } else {
+ else
return 1;
- }
} else {
- cmd_usage(cmdtp);
- rcode = 1;
+ return cmd_usage(cmdtp);
}
return rcode;
@@ -374,9 +369,8 @@
boot_device = argv[2];
break;
default:
- cmd_usage(cmdtp);
show_boot_progress (-42);
- return 1;
+ return cmd_usage(cmdtp);
}
show_boot_progress (42);
diff --git a/common/cmd_irq.c b/common/cmd_irq.c
index 4888328..d35a43f 100644
--- a/common/cmd_irq.c
+++ b/common/cmd_irq.c
@@ -27,17 +27,14 @@
int do_interrupts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
/* on */
- if (strncmp(argv[1], "on", 2) == 0) {
+ if (strncmp(argv[1], "on", 2) == 0)
enable_interrupts();
- } else {
+ else
disable_interrupts();
- }
return 0;
}
diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index e88d6e0..8dd8927 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -165,10 +165,8 @@
int value, w;
/* Validate arguments */
- if ((argc != 4)){
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc != 4))
+ return cmd_usage(cmdtp);
/* Check for a data width specification.
* Defaults to long (4) if no specification.
diff --git a/common/cmd_load.c b/common/cmd_load.c
index 52ed1fa..dad0303 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -1102,7 +1102,7 @@
if (strcmp(argv[1], "on") == 0)
hwflow_onoff(1);
else
- cmd_usage(cmdtp);
+ return cmd_usage(cmdtp);
}
printf("RTS/CTS hardware flow control: %s\n", hwflow_onoff(0) ? "on" : "off");
return 0;
diff --git a/common/cmd_log.c b/common/cmd_log.c
index 49deddd..0e89357 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -241,12 +241,10 @@
}
return 0;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
}
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index bcea399..44834ea 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -76,10 +76,8 @@
size = dp_last_size;
length = dp_last_length;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command specified. Check for a size specification.
@@ -172,10 +170,8 @@
ulong addr, writeval, count;
int size;
- if ((argc < 3) || (argc > 4)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc < 3) || (argc > 4))
+ return cmd_usage(cmdtp);
/* Check for size specification.
*/
@@ -216,10 +212,8 @@
int i;
ulong count;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
count = simple_strtoul(argv[3], NULL, 10);
@@ -245,10 +239,8 @@
int i;
ulong count;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
count = simple_strtoul(argv[3], NULL, 10);
@@ -276,10 +268,8 @@
int size;
int rcode = 0;
- if (argc != 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 4)
+ return cmd_usage(cmdtp);
/* Check for size specification.
*/
@@ -360,10 +350,8 @@
ulong addr, dest, count;
int size;
- if (argc != 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 4)
+ return cmd_usage(cmdtp);
/* Check for size specification.
*/
@@ -484,10 +472,8 @@
volatile ushort *shortp;
volatile u_char *cp;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/* Check for a size spefication.
* Defaults to long if no or incorrect specification.
@@ -555,10 +541,8 @@
volatile ushort *shortp;
volatile u_char *cp;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/* Check for a size spefication.
* Defaults to long if no or incorrect specification.
@@ -990,10 +974,8 @@
int nbytes, size;
extern char console_buffer[];
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* got a good command to get here */
@@ -1095,10 +1077,8 @@
ulong crc;
ulong *ptr;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul (argv[1], NULL, 16);
addr += base_address;
@@ -1131,9 +1111,8 @@
char * const *av;
if (argc < 3) {
- usage:
- cmd_usage(cmdtp);
- return 1;
+usage:
+ return cmd_usage(cmdtp);
}
av = argv + 1;
@@ -1181,10 +1160,8 @@
unsigned int i;
u8 output[16];
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
len = simple_strtoul(argv[2], NULL, 16);
@@ -1206,10 +1183,8 @@
unsigned int i;
u8 output[20];
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
len = simple_strtoul(argv[2], NULL, 16);
@@ -1239,8 +1214,7 @@
dst = simple_strtoul(argv[2], NULL, 16);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c
index eeef2cd..00180b0 100644
--- a/common/cmd_mfsl.c
+++ b/common/cmd_mfsl.c
@@ -37,17 +37,14 @@
unsigned int num;
unsigned int blocking;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16);
if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
puts ("Bad number of FSL\n");
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
switch (fslnum) {
@@ -195,18 +192,14 @@
unsigned int num;
unsigned int blocking;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
num = (unsigned int)simple_strtoul (argv[2], NULL, 16);
blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16);
- if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER)
+ return cmd_usage(cmdtp);
switch (fslnum) {
#if (XILINX_FSL_NUMBER > 0)
@@ -353,10 +346,9 @@
unsigned int reg = 0;
unsigned int val = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
reg = (unsigned int)simple_strtoul (argv[1], NULL, 16);
val = (unsigned int)simple_strtoul (argv[2], NULL, 16);
switch (reg) {
diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index 1619a25..bb94186 100644
--- a/common/cmd_mii.c
+++ b/common/cmd_mii.c
@@ -301,10 +301,8 @@
int rcode = 0;
char *devname;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
#if defined(CONFIG_MII_INIT)
mii_init ();
@@ -431,8 +429,7 @@
else
miiphy_set_current_dev (argv[2]);
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/*
diff --git a/common/cmd_misc.c b/common/cmd_misc.c
index 8439da2..061b1bb 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -32,17 +32,15 @@
ulong start = get_timer(0);
ulong delay;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ;
while (get_timer(start) < delay) {
- if (ctrlc ()) {
+ if (ctrlc ())
return (-1);
- }
+
udelay (100);
}
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 698157f..e5f5e94 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -32,10 +32,8 @@
{
int dev;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "init") == 0) {
if (argc == 2) {
@@ -46,8 +44,7 @@
} else if (argc == 3) {
dev = (int)simple_strtoul(argv[2], NULL, 10);
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (mmc_legacy_init(dev) != 0) {
@@ -72,14 +69,12 @@
#endif
curr_device = dev;
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
printf("mmc%d is current device\n", curr_device);
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
diff --git a/common/cmd_mp.c b/common/cmd_mp.c
index 4d7b871..f19bf41 100644
--- a/common/cmd_mp.c
+++ b/common/cmd_mp.c
@@ -28,10 +28,8 @@
{
unsigned long cpuid;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
cpuid = simple_strtoul(argv[1], NULL, 10);
if (cpuid >= cpu_numcores()) {
@@ -42,29 +40,24 @@
if (argc == 3) {
- if (strncmp(argv[2], "reset", 5) == 0) {
+ if (strncmp(argv[2], "reset", 5) == 0)
cpu_reset(cpuid);
- } else if (strncmp(argv[2], "status", 6) == 0) {
+ else if (strncmp(argv[2], "status", 6) == 0)
cpu_status(cpuid);
- } else if (strncmp(argv[2], "disable", 7) == 0) {
+ else if (strncmp(argv[2], "disable", 7) == 0)
return cpu_disable(cpuid);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
+
return 0;
}
/* 4 or greater, make sure its release */
- if (strncmp(argv[2], "release", 7) != 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (strncmp(argv[2], "release", 7) != 0)
+ return cmd_usage(cmdtp);
- if (cpu_release(cpuid, argc - 3, argv + 3)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (cpu_release(cpuid, argc - 3, argv + 3))
+ return cmd_usage(cmdtp);
return 0;
}
diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 447486b..ceec5a9 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -1845,8 +1845,7 @@
return delete_partition(argv[2]);
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/***************************************************/
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 84b6272..0f47a25 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -275,8 +275,7 @@
return ret;
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
#endif
@@ -577,8 +576,7 @@
#endif
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(nand, CONFIG_SYS_MAXARGS, 1, do_nand,
@@ -759,9 +757,8 @@
#if defined(CONFIG_CMD_MTDPARTS)
usage:
#endif
- cmd_usage(cmdtp);
show_boot_progress(-53);
- return 1;
+ return cmd_usage(cmdtp);
}
show_boot_progress(53);
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 3cdb07f..3ffb9df 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -186,9 +186,9 @@
break;
- default: cmd_usage(cmdtp);
+ default:
show_boot_progress (-80);
- return 1;
+ return cmd_usage(cmdtp);
}
show_boot_progress (80);
@@ -236,10 +236,8 @@
return -1;
NetPingIP = string_to_ip(argv[1]);
- if (NetPingIP == 0) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (NetPingIP == 0)
+ return cmd_usage(cmdtp);
if (NetLoop(PING) < 0) {
printf("ping failed; host %s is not alive\n", argv[1]);
@@ -342,10 +340,8 @@
#if defined(CONFIG_CMD_DNS)
int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc == 1) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (argc == 1)
+ return cmd_usage(cmdtp);
/*
* We should check for a valid hostname:
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 13325bc..1198954 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -407,10 +407,8 @@
int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
return _do_setenv (flag, argc, argv);
}
@@ -433,15 +431,13 @@
local_args[2] = NULL;
local_args[3] = NULL;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
/* Check the syntax */
switch (argc) {
case 1:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 2: /* askenv envname */
sprintf (message, "Please enter '%s':", argv[1]);
@@ -503,10 +499,8 @@
char *init_val;
int len;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
/* Set read buffer to initial value or empty sting */
init_val = getenv(argv[1]);
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 @@
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 @@
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 @@
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 @@
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 @@
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(
diff --git a/common/cmd_otp.c b/common/cmd_otp.c
index a8c73b5..43f7c69 100644
--- a/common/cmd_otp.c
+++ b/common/cmd_otp.c
@@ -88,8 +88,7 @@
if (argc < 4) {
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
prompt_user = false;
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index 358ca60..4bde059 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -534,8 +534,7 @@
return 1;
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/***************************************************/
diff --git a/common/cmd_portio.c b/common/cmd_portio.c
index 92d61d2..4f2f499 100644
--- a/common/cmd_portio.c
+++ b/common/cmd_portio.c
@@ -43,13 +43,12 @@
uint size = out_last_size;
uint value = out_last_value;
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
- /* New command specified. Check for a size specification.
+ /*
+ * New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
size = cmd_get_data_size (argv[0], 1);
@@ -102,13 +101,12 @@
uint addr = in_last_addr;
uint size = in_last_size;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
- /* New command specified. Check for a size specification.
+ /*
+ * New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
size = cmd_get_data_size (argv[0], 1);
diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c
index 2133a1f..ced1d40 100644
--- a/common/cmd_reiser.c
+++ b/common/cmd_reiser.c
@@ -56,10 +56,9 @@
block_dev_desc_t *dev_desc=NULL;
int part_length;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
+
dev = (int)simple_strtoul (argv[2], &ep, 16);
dev_desc = get_dev(argv[1],dev);
@@ -150,8 +149,7 @@
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!filename) {
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index 7be58e5..7efa859 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -77,8 +77,7 @@
switch (argc) {
case 0:
case 1:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 2:
if (strncmp(argv[1],"inf", 3) == 0) {
int i;
@@ -115,8 +114,7 @@
}
return rc;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1], "dev", 3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
@@ -147,8 +145,7 @@
}
return rc;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default: /* at least 4 args */
if (strcmp(argv[1], "read") == 0) {
@@ -184,8 +181,7 @@
n, (n == cnt) ? "OK" : "ERROR");
return (n == cnt) ? 0 : 1;
} else {
- cmd_usage(cmdtp);
- rc = 1;
+ return cmd_usage(cmdtp);
}
return rc;
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 5b2df28..6b937f9 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -229,8 +229,7 @@
boot_device = argv[2];
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!boot_device) {
@@ -346,7 +345,8 @@
{
switch (argc) {
case 0:
- case 1: cmd_usage(cmdtp); return 1;
+ case 1: return cmd_usage(cmdtp);
+
case 2:
if (strncmp(argv[1],"res",3) == 0) {
printf("\nReset SCSI\n");
@@ -392,8 +392,7 @@
printf("\nno SCSI devices available\n");
return 1;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1],"dev",3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
@@ -421,8 +420,7 @@
}
return 1;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default:
/* at least 4 args */
if (strcmp(argv[1],"read") == 0) {
@@ -437,8 +435,7 @@
return 0;
}
} /* switch */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/****************************************************************************************
diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c
index b3e489f..1ff1232 100644
--- a/common/cmd_setexpr.c
+++ b/common/cmd_setexpr.c
@@ -57,10 +57,8 @@
int w;
/* Validate arguments */
- if ((argc != 5) || (strlen(argv[3]) != 1)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc != 5) || (strlen(argv[3]) != 1))
+ return cmd_usage(cmdtp);
w = cmd_get_data_size(argv[0], 4);
diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index 4826e9f..6e7be81 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -177,8 +177,7 @@
return do_spi_flash_erase(argc - 1, argv + 1);
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
diff --git a/common/cmd_strings.c b/common/cmd_strings.c
index bbbb6b4..144a6c1 100644
--- a/common/cmd_strings.c
+++ b/common/cmd_strings.c
@@ -14,10 +14,8 @@
int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc == 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc == 1)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 2faf8d8..77ca0a5 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -442,10 +442,8 @@
ulong addr = 0;
int err = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (mtdparts_init() != 0) {
printf("Error initializing mtdparts!\n");
@@ -471,10 +469,8 @@
return 0;
}
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/* todo: get dev number for NAND... */
ubi_dev.nr = 0;
diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c
index 9017041..2cab793e 100644
--- a/common/cmd_ubifs.c
+++ b/common/cmd_ubifs.c
@@ -47,10 +47,9 @@
char *vol_name;
int ret;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
+
vol_name = argv[1];
debug("Using volume %s\n", vol_name);
@@ -102,25 +101,19 @@
return -1;
}
- if (argc < 3) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], &endp, 16);
- if (endp == argv[1]) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (endp == argv[1])
+ return cmd_usage(cmdtp);
filename = argv[2];
if (argc == 4) {
size = simple_strtoul(argv[3], &endp, 16);
- if (endp == argv[3]) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (endp == argv[3])
+ return cmd_usage(cmdtp);
}
debug("Loading file '%s' to address 0x%08x (size %d)\n", filename, addr, size);
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 73d74ac..dc63f24 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -376,8 +376,7 @@
boot_device = argv[2];
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!boot_device) {
@@ -516,10 +515,8 @@
block_dev_desc_t *stor_dev;
#endif
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if ((strncmp(argv[1], "reset", 5) == 0) ||
(strncmp(argv[1], "start", 5) == 0)) {
@@ -699,8 +696,7 @@
return 0;
}
#endif /* CONFIG_USB_STORAGE */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
#ifdef CONFIG_USB_STORAGE
diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c
index 1429d31..18c14d1 100644
--- a/common/cmd_vfd.c
+++ b/common/cmd_vfd.c
@@ -49,10 +49,8 @@
{
ulong bitmap;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
if (argv[1][0] == '/') { /* select bitmap by number */
bitmap = simple_strtoul(argv[1]+1, NULL, 10);
diff --git a/common/command.c b/common/command.c
index a1fc592..30a9801 100644
--- a/common/command.c
+++ b/common/command.c
@@ -153,7 +153,7 @@
puts (cmdtp->help);
putc ('\n');
#endif /* CONFIG_SYS_LONGHELP */
- return 0;
+ return 1;
}
#ifdef CONFIG_AUTO_COMPLETE
diff --git a/common/hush.c b/common/hush.c
index 8a74d22..4dd9513 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1694,10 +1694,8 @@
}
#endif
/* found - check max args */
- if ((child->argc - i) > cmdtp->maxargs) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if ((child->argc - i) > cmdtp->maxargs)
+ return cmd_usage(cmdtp);
#endif
child->argv+=i; /* XXX horrible hack */
#ifndef __U_BOOT__
diff --git a/common/main.c b/common/main.c
index 20090ee..54ef79e 100644
--- a/common/main.c
+++ b/common/main.c
@@ -1418,10 +1418,8 @@
{
int i;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
for (i=1; i<argc; ++i) {
char *arg;