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>
This commit is contained in:
Wolfgang Denk 2010-07-17 01:06:04 +02:00
parent debb6299ac
commit 47e26b1bf9
89 changed files with 454 additions and 833 deletions

View File

@ -111,10 +111,8 @@ int mpc5121diu_init_show_bmp(cmd_tbl_t *cmdtp,
{
unsigned int addr;
if (argc < 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 2)
return cmd_usage(cmdtp);
if (!strncmp(argv[1], "init", 4)) {
#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)

View File

@ -71,10 +71,7 @@ void bedbug603e_do_break (cmd_tbl_t *cmdtp, int flag, int argc,
/* -------------------------------------------------- */
if (argc < 2)
{
cmd_usage(cmdtp);
return;
}
return cmd_usage(cmdtp);
/* Turn off a breakpoint */
@ -118,10 +115,7 @@ void bedbug603e_do_break (cmd_tbl_t *cmdtp, int flag, int argc,
if(!(( isdigit( argv[ 1 ][ 0 ] )) ||
(( argv[ 1 ][ 0 ] >= 'a' ) && ( argv[ 1 ][ 0 ] <= 'f' )) ||
(( argv[ 1 ][ 0 ] >= 'A' ) && ( argv[ 1 ][ 0 ] <= 'F' ))))
{
cmd_usage(cmdtp);
return;
}
return cmd_usage(cmdtp);
addr = simple_strtoul( argv[ 1 ], NULL, 16 );

View File

@ -118,10 +118,8 @@ int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
writeback[0] = 0x01234567UL;
writeback[1] = 0x89abcdefUL;
if (argc > 4) {
cmd_usage(cmdtp);
return 1;
}
if (argc > 4)
return cmd_usage(cmdtp);
if (argc == 2) {
if (strcmp(argv[1], "status") == 0) {
@ -350,8 +348,7 @@ int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 0;
}
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(ecc, 4, 0, do_ecc,

View File

@ -70,10 +70,7 @@ void bedbug860_do_break (cmd_tbl_t *cmdtp, int flag, int argc,
/* -------------------------------------------------- */
if (argc < 2)
{
cmd_usage(cmdtp);
return;
}
return cmd_usage(cmdtp);
/* Turn off a breakpoint */
@ -121,10 +118,7 @@ void bedbug860_do_break (cmd_tbl_t *cmdtp, int flag, int argc,
/* Set a breakpoint at the address */
if( !isdigit( argv[ 1 ][ 0 ]))
{
cmd_usage(cmdtp);
return;
}
return cmd_usage(cmdtp);
addr = simple_strtoul( argv[ 1 ], NULL, 16 ) & 0xfffffffc;

View File

@ -44,10 +44,8 @@ static int do_bootstrap(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
u8 *buf;
int cpu_freq;
if (argc < 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 3)
return cmd_usage(cmdtp);
cpu_freq = simple_strtol(argv[1], NULL, 10);
if (cpu_freq != 267) {

View File

@ -223,8 +223,7 @@ int do_l2cache( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] )
l2cache_status() ? "ON" : "OFF");
return 0;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
return 0;

View File

@ -182,14 +182,14 @@ do_pll_alter (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char c = '\0';
pll_freq_t pll_freq;
if (argc < 2) {
cmd_usage(cmdtp);
goto ret;
}
for (pll_freq = PLL_ebc20; pll_freq < PLL_TOTAL; pll_freq++)
if (argc < 2)
return cmd_usage(cmdtp);
for (pll_freq = PLL_ebc20; pll_freq < PLL_TOTAL; pll_freq++) {
if (!strcmp(pll_name[pll_freq], argv[1]))
break;
}
switch (pll_freq) {
case PLL_ebc20:
@ -223,8 +223,7 @@ do_pll_alter (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
default:
printf("Invalid options\n\n");
cmd_usage(cmdtp);
goto ret;
return cmd_usage(cmdtp);
}
printf("PLL set to %s, "

View File

@ -139,10 +139,9 @@ static int do_lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const arg
static int do_lcd_puts (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);
lcd_puts(argv[1]);
return 0;
@ -150,10 +149,9 @@ static int do_lcd_puts (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv
static int do_lcd_putc (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);
lcd_putc((char)argv[1][0]);
return 0;
@ -165,10 +163,8 @@ static int do_lcd_cur (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[
ulong dir;
char cur_addr;
if (argc < 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 3)
return cmd_usage(cmdtp);
count = simple_strtoul(argv[1], NULL, 16);
if (count > 31) {

View File

@ -101,16 +101,12 @@ static int do_led_ctl(cmd_tbl_t* cmd_tp, int flags, int argc, char * const argv[
{
int led_no;
if (argc != 3) {
cmd_usage(cmd_tp);
return -1;
}
if (argc != 3)
return cmd_usage(cmd_tp);
led_no = simple_strtoul(argv[1], NULL, 16);
if (led_no != 1 && led_no != 2) {
cmd_usage(cmd_tp);
return -1;
}
if (led_no != 1 && led_no != 2)
return cmd_usage(cmd_tp);
if (strcmp(argv[2],"off") == 0x0) {
if (led_no == 1)
@ -123,8 +119,7 @@ static int do_led_ctl(cmd_tbl_t* cmd_tp, int flags, int argc, char * const argv[
else
gpio_write_bit(31, 0);
} else {
cmd_usage(cmd_tp);
return -1;
return cmd_usage(cmd_tp);
}
return 0;

View File

@ -166,19 +166,17 @@ static int do_lcd_clear(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv
}
static int do_lcd_puts(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);
lcd_puts(argv[1]);
return 0;
}
static int do_lcd_putc(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);
lcd_putc((char)argv[1][0]);
return 0;
}
@ -188,10 +186,8 @@ static int do_lcd_cur(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]
ulong dir;
char cur_addr;
if (argc < 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 3)
return cmd_usage(cmdtp);
count = simple_strtoul(argv[1], NULL, 16);
if (count > 31) {

View File

@ -58,10 +58,8 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
char plbClock[4];
char pcixClock[4];
if (argc < 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 3)
return cmd_usage(cmdtp);
if (strcmp(argv[2], "prom0") == 0)
chip = IIC0_BOOTPROM_ADDR;

View File

@ -290,12 +290,6 @@ void barcobcd_boot (void)
int barcobcd_boot_image (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
#if 0
if (argc > 1) {
cmd_usage(cmdtp);
return 1;
}
#endif
barcobcd_boot ();
return 0;

View File

@ -75,10 +75,8 @@ static int do_mtc_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int err;
int i;
if (argc < 2) {
cmd_usage(cmdtp);
return -1;
}
if (argc < 2)
return cmd_usage(cmdtp);
memset(&pcmd, 0, sizeof(pcmd));
memset(&prx, 0, sizeof(prx));
@ -149,10 +147,8 @@ static int do_mtc_digout(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
int err;
uchar channel_mask = 0;
if (argc < 3) {
cmd_usage(cmdtp);
return -1;
}
if (argc < 3)
return cmd_usage(cmdtp);
if (strncmp(argv[1], "on", 2) == 0)
channel_mask |= 1;
@ -178,10 +174,8 @@ static int do_mtc_digin(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
int err;
uchar channel_num = 0;
if (argc < 2) {
cmd_usage(cmdtp);
return -1;
}
if (argc < 2)
return cmd_usage(cmdtp);
channel_num = simple_strtol(argv[1], NULL, 10);
if ((channel_num != 1) && (channel_num != 2)) {
@ -332,8 +326,7 @@ int cmd_mtc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return c->cmd(c, flag, argc, argv);
} else {
/* Unrecognized command */
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
return err;

View File

@ -345,10 +345,8 @@ int do_esdbmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#ifdef CONFIG_VIDEO_SM501
char *str;
#endif
if (argc != 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc != 2)
return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);

View File

@ -221,9 +221,7 @@ int do_pci9054 (cmd_tbl_t * cmdtp, int flag, int argc,
return 0;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -351,8 +351,7 @@ int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
prog_eeprom();
break;
default:
cmd_usage(cmdtp);
break;
return cmd_usage(cmdtp);
}
return 0;
@ -388,8 +387,7 @@ int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
break;
case 'h': /* help */
default:
cmd_usage(cmdtp);
break;
return cmd_usage(cmdtp);
}
return 0;

View File

@ -115,10 +115,8 @@ int mpc8610diu_init_show_bmp(cmd_tbl_t *cmdtp,
{
unsigned int addr;
if (argc < 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 2)
return cmd_usage(cmdtp);
if (!strncmp(argv[1],"init",4)) {
#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)

View File

@ -272,8 +272,7 @@ do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
break;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(
fpga, 6, 1, do_fpga,
@ -324,8 +323,7 @@ do_eecl (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
/* fall through ... */
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
memset (data, 0, HYMOD_EEPROM_SIZE);

View File

@ -168,8 +168,7 @@ static int do_inkadiag_io(cmd_tbl_t *cmdtp, int flag, int argc,
printf("exit code: 0x%X\n", val);
return 0;
default:
cmd_usage(cmdtp);
break;
return cmd_usage(cmdtp);
}
return -1;
@ -244,10 +243,8 @@ static int do_inkadiag_serial(cmd_tbl_t *cmdtp, int flag, int argc,
int combrd, baudrate, i, j, len;
int address;
if (argc < 5) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 5)
return cmd_usage(cmdtp);
argc--;
argv++;
@ -394,10 +391,8 @@ static int do_inkadiag_buzzer(cmd_tbl_t *cmdtp, int flag, int argc,
unsigned int period, freq;
int prev, i;
if (argc != 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc != 3)
return cmd_usage(cmdtp);
argc--;
argv++;
@ -474,8 +469,7 @@ static int do_inkadiag(cmd_tbl_t *cmdtp, int flag, int argc,
return c->cmd(c, flag, argc, argv);
} else {
/* Unrecognized command */
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
}

View File

@ -186,10 +186,8 @@ int board_init(void)
int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
u32 tmp;
if (argc < 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 2)
return cmd_usage(cmdtp);
if ((strcmp(argv[1], "off") == 0)) {
printf("SPI FLASH disabled, NAND enabled\n");
@ -214,8 +212,7 @@ int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
tmp = readl(KW_GPIO0_BASE);
writel(tmp & (~FLASH_GPIO_PIN) , KW_GPIO0_BASE);
} else {
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
return 0;

View File

@ -845,8 +845,7 @@ int do_pic (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
default:
break;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(
pic, 4, 1, do_pic,
@ -975,8 +974,7 @@ int do_lsb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
default:
break;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -306,20 +306,15 @@ void hw_watchdog_reset(void)
int do_eeprom_wp(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);
if ((strcmp(argv[1], "on") == 0)) {
if ((strcmp(argv[1], "on") == 0))
gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 1);
} else if ((strcmp(argv[1], "off") == 0)) {
else if ((strcmp(argv[1], "off") == 0))
gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 0);
} else {
cmd_usage(cmdtp);
return 1;
}
else
return cmd_usage(cmdtp);
return 0;
}

View File

@ -528,8 +528,7 @@ int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
#endif
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}

View File

@ -232,8 +232,7 @@ int do_wd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
default:
break;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -616,9 +616,8 @@ int do_sha1 (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int rcode = -1;
if (argc < 2) {
usage:
cmd_usage(cmdtp);
return 1;
usage:
return cmd_usage(cmdtp);
}
if (argc >= 3) {

View File

@ -635,10 +635,8 @@ static int set_lcd_brightness(char *brightness)
static int cmd_lcd_brightness(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 set_lcd_brightness(argv[1]);
}

View File

@ -36,20 +36,20 @@ extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
/*
* Command led: controls the various LEDs 0..11 on the PN62 card.
*/
int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int do_led(cmd_tbl_t * cmdtp, int flag, int argc, char *const argv[])
{
unsigned int number, function;
unsigned int number, function;
if (argc != 3) {
cmd_usage(cmdtp);
return 1;
}
number = simple_strtoul(argv[1], NULL, 10);
if (number > PN62_LED_MAX)
return 1;
function = simple_strtoul(argv[2], NULL, 16);
set_led (number, function);
return 0;
if (argc != 3)
return cmd_usage(cmdtp);
number = simple_strtoul(argv[1], NULL, 10);
if (number > PN62_LED_MAX)
return 1;
function = simple_strtoul(argv[2], NULL, 16);
set_led(number, function);
return 0;
}
U_BOOT_CMD(
led , 3, 1, do_led,
@ -83,8 +83,7 @@ int do_loadpci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
addr = simple_strtoul(argv[1], NULL, 16);
break;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
printf ("## Ready for image download ...\n");

View File

@ -214,10 +214,8 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
ulong addr;
if (argc < 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 2)
return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);

View File

@ -304,10 +304,8 @@ int do_set_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned char mac[6];
char *s, *e;
if (argc != 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc != 2)
return cmd_usage(cmdtp);
s = argv[1];
@ -330,10 +328,8 @@ U_BOOT_CMD(
int do_print_mac(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);
mac_read();

View File

@ -112,10 +112,8 @@ int do_hw_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *cmd;
if (argc != 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc != 2)
return cmd_usage(cmdtp);
cmd = argv[1];
switch (cmd[0]) {
@ -150,8 +148,7 @@ int do_hw_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
test_net();
break;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
return 0;

View File

@ -286,8 +286,7 @@ int do_fpga (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
failure:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -399,8 +399,7 @@ int do_puma (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
default:
break;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD (puma, 4, 1, do_puma,

View File

@ -215,10 +215,8 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *s, *e;
char i2c_mac[20];
if ((argc > 3) || (argc < 2)) {
cmd_usage(cmdtp);
return 1;
}
if ((argc > 3) || (argc < 2))
return cmd_usage(cmdtp);
if ((!strcmp(argv[1], "cpufreq")) || (!strcmp(argv[1], "ddrfreq"))) {
@ -286,8 +284,7 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(chip_config, 3, 1, do_chip_config,

View File

@ -327,8 +327,7 @@ static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
switch (argc) {
case 0:
case 1:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
case 2:
if (strncmp(argv[1],"saw",3) == 0) {
printf ("Play sawtooth\n");
@ -342,8 +341,7 @@ static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return rcode;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1],"saw",3) == 0) {
duration = simple_strtoul(argv[2], NULL, 10);
@ -358,8 +356,7 @@ static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
LEFT_RIGHT);
return rcode;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
case 4:
if (strncmp(argv[1],"saw",3) == 0) {
duration = simple_strtoul(argv[2], NULL, 10);
@ -382,8 +379,7 @@ static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
pcm1772_write_reg((uchar)reg, (uchar)val);
return 0;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
case 5:
if (strncmp(argv[1],"saw",3) == 0) {
duration = simple_strtoul(argv[2], NULL, 10);
@ -412,8 +408,7 @@ static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
channel);
return rcode;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
printf ("Usage:\nsound cmd [arg1] [arg2] ...\n");
return 1;
@ -513,8 +508,7 @@ static int cmd_beep(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
channel = LEFT_RIGHT;
break;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
if ((tmp = getenv ("volume")) != NULL) {

View File

@ -167,10 +167,8 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int i;
int cycle_status;
if (argc > 1) {
cmd_usage(cmdtp);
return 1;
}
if (argc > 1)
return cmd_usage(cmdtp);
led_init ();
global_vars_init ();
@ -270,14 +268,11 @@ int do_dip (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int i, dip;
if (argc > 1) {
cmd_usage(cmdtp);
return 1;
}
if (argc > 1)
return cmd_usage(cmdtp);
if ((dip = read_dip ()) == -1) {
if ((dip = read_dip ()) == -1)
return 1;
}
for (i = 0; i < 4; i++) {
if ((dip & (1 << i)) == 0)
@ -303,14 +298,11 @@ int do_vcc5v (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int vcc5v;
if (argc > 1) {
cmd_usage(cmdtp);
return 1;
}
if (argc > 1)
return cmd_usage(cmdtp);
if ((vcc5v = read_vcc5v ()) == -1) {
if ((vcc5v = read_vcc5v ()) == -1)
return (1);
}
printf ("%d", (vcc5v / 1000));
printf (".%d", (vcc5v % 1000) / 100);
@ -331,10 +323,8 @@ int do_contact_temp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int contact_temp;
if (argc > 1) {
cmd_usage(cmdtp);
return 1;
}
if (argc > 1)
return cmd_usage(cmdtp);
tsc2000_spi_init ();
@ -354,36 +344,32 @@ U_BOOT_CMD(
int do_burn_in_status (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 (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1,
(unsigned char*) &status, 1)) {
(unsigned char*) &status, 1))
return (1);
}
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1,
(unsigned char*) &pass_cycles, 2)) {
(unsigned char*) &pass_cycles, 2))
return (1);
}
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE,
1, (unsigned char*) &first_error_cycle, 2)) {
1, (unsigned char*) &first_error_cycle, 2))
return (1);
}
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM,
1, (unsigned char*) &first_error_num, 1)) {
1, (unsigned char*) &first_error_num, 1))
return (1);
}
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
1, (unsigned char*)first_error_name,
sizeof (first_error_name))) {
sizeof (first_error_name)))
return (1);
}
if (read_max_cycles () != 0) {
if (read_max_cycles () != 0)
return (1);
}
printf ("max_cycles = %d\n", max_cycles);
printf ("status = %d\n", status);
@ -850,14 +836,11 @@ int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
struct rtc_time tm;
#endif
if (argc > 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc > 2)
return cmd_usage(cmdtp);
if (argc > 1) {
if (argc > 1)
delay = simple_strtoul(argv[1], NULL, 10);
}
tsc2000_spi_init ();
while (1) {

View File

@ -42,36 +42,29 @@ static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *
static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
int offset,value;
if (argc < 4) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 4)
return cmd_usage(cmdtp);
offset=simple_strtoul(argv[2],NULL,16);
value=simple_strtoul(argv[3],NULL,16);
if (offset > 0x40) {
printf("Wrong offset : 0x%x\n",offset);
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
dm9000_write_srom_word(offset, value);
return (0);
}
int do_dm9000_eeprom ( 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);
if (strcmp (argv[1],"read") == 0) {
if (strcmp (argv[1],"read") == 0)
return (do_read_dm9000_eeprom(cmdtp,flag,argc,argv));
} else if (strcmp (argv[1],"write") == 0) {
else if (strcmp (argv[1],"write") == 0)
return (do_write_dm9000_eeprom(cmdtp,flag,argc,argv));
} else {
cmd_usage(cmdtp);
return 1;
}
else
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -38,10 +38,8 @@ int do_vpd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
uchar dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
/* Validate usage */
if (argc > 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc > 2)
return cmd_usage(cmdtp);
/* Passed in EEPROM address */
if (argc == 2)

View File

@ -84,10 +84,8 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
/* -------------------------------------------------- */
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);

View File

@ -102,8 +102,7 @@ static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[
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 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
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 @@ static int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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(

View File

@ -40,10 +40,8 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);

View File

@ -491,17 +491,14 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
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;

View File

@ -34,10 +34,6 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
icache_status() ? "ON" : "OFF");
return 0;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
return 0;
}
@ -60,10 +55,6 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
dcache_status() ? "ON" : "OFF");
return 0;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
return 0;

View File

@ -44,10 +44,8 @@ int do_getdcr ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] )
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 @@ int do_setdcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_getidcr (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_setidcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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);

View File

@ -27,8 +27,7 @@ static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
usage:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -104,8 +104,7 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
#endif

View File

@ -65,10 +65,9 @@ int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
break;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
if (!filename) {

View File

@ -741,8 +741,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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) {

View File

@ -73,8 +73,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
name = argv [2];
break;
default:
cmd_usage(cmdtp);
break;
return cmd_usage(cmdtp);
}
/* Init physical layer */

View File

@ -65,14 +65,12 @@ void set_working_fdt_addr(void *addr)
*/
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
}
/********************************************************************
/*
* 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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
/*
* 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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
/*
* 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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
}
/********************************************************************
/*
* 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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
} else {
/* Unrecognized command */
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
}
#ifdef CONFIG_OF_BOARD_SETUP
@ -430,10 +421,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
else {
/* Unrecognized command */
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
return 0;

View File

@ -332,10 +332,8 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#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 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
#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 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
#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 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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;

View File

@ -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 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
switch (op) {
case FPGA_NONE:
fpga_usage (cmdtp);
break;
return cmd_usage(cmdtp);
case FPGA_INFO:
rc = fpga_info (dev);
@ -312,17 +310,11 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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.

View File

@ -184,10 +184,8 @@ static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
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 @@ static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
*/
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 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
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 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
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 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
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 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
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 @@ static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
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 @@ static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
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 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
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 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
*/
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 @@ static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
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 @@ static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
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 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
"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 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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);
}
/***************************************************/

View File

@ -179,8 +179,7 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
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 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
default:
/* at least 4 args */
@ -332,14 +329,12 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
boot_device = argv[2];
break;
default:
cmd_usage(cmdtp);
show_boot_progress (-42);
return 1;
return cmd_usage(cmdtp);
}
show_boot_progress (42);

View File

@ -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;
}

View File

@ -165,10 +165,8 @@ int do_itest ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] )
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.

View File

@ -1102,7 +1102,7 @@ int do_hwflow (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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;

View File

@ -241,12 +241,10 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
return 0;
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
}

View File

@ -76,10 +76,8 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
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 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char * const *av;
if (argc < 3) {
usage:
cmd_usage(cmdtp);
return 1;
usage:
return cmd_usage(cmdtp);
}
av = argv + 1;
@ -1181,10 +1160,8 @@ int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);

View File

@ -37,17 +37,14 @@ int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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) {

View File

@ -301,10 +301,8 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
else
miiphy_set_current_dev (argv[2]);
} else {
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
/*

View File

@ -32,17 +32,15 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);
}

View File

@ -32,10 +32,8 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
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 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
} 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 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#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;

View File

@ -28,10 +28,8 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
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 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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;
}

View File

@ -1845,8 +1845,7 @@ int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return delete_partition(argv[2]);
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
/***************************************************/

View File

@ -275,8 +275,7 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, nand_info_t *nand,
return ret;
usage:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
#endif
@ -577,8 +576,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
#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 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_MTDPARTS)
usage:
#endif
cmd_usage(cmdtp);
show_boot_progress(-53);
return 1;
return cmd_usage(cmdtp);
}
show_boot_progress(53);

View File

@ -186,9 +186,9 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char * const argv[])
break;
default: cmd_usage(cmdtp);
default:
show_boot_progress (-80);
return 1;
return cmd_usage(cmdtp);
}
show_boot_progress (80);
@ -236,10 +236,8 @@ int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ U_BOOT_CMD(
#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:

View File

@ -407,10 +407,8 @@ void forceenv (char *varname, char *varvalue)
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 @@ int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_editenv(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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]);

View File

@ -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(

View File

@ -88,8 +88,7 @@ int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc < 4) {
usage:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
prompt_user = false;

View File

@ -534,8 +534,7 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
usage:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
/***************************************************/

View File

@ -43,13 +43,12 @@ int do_portio_out (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_portio_in (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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);

View File

@ -56,10 +56,9 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
break;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
if (!filename) {

View File

@ -77,8 +77,7 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
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 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
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 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
n, (n == cnt) ? "OK" : "ERROR");
return (n == cnt) ? 0 : 1;
} else {
cmd_usage(cmdtp);
rc = 1;
return cmd_usage(cmdtp);
}
return rc;

View File

@ -229,8 +229,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
boot_device = argv[2];
break;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
if (!boot_device) {
@ -346,7 +345,8 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
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 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
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 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
} /* switch */
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
/****************************************************************************************

View File

@ -57,10 +57,8 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);

View File

@ -177,8 +177,7 @@ static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
return do_spi_flash_erase(argc - 1, argv + 1);
usage:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -14,10 +14,8 @@ static char *start_addr, *last_addr;
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);

View File

@ -442,10 +442,8 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
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;

View File

@ -47,10 +47,9 @@ int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);

View File

@ -376,8 +376,7 @@ int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
boot_device = argv[2];
break;
default:
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
if (!boot_device) {
@ -516,10 +515,8 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
#endif /* CONFIG_USB_STORAGE */
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
#ifdef CONFIG_USB_STORAGE

View File

@ -49,10 +49,8 @@ int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
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);

View File

@ -153,7 +153,7 @@ int cmd_usage(cmd_tbl_t *cmdtp)
puts (cmdtp->help);
putc ('\n');
#endif /* CONFIG_SYS_LONGHELP */
return 0;
return 1;
}
#ifdef CONFIG_AUTO_COMPLETE

View File

@ -1694,10 +1694,8 @@ static int run_pipe_real(struct pipe *pi)
}
#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__

View File

@ -1418,10 +1418,8 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
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;

View File

@ -164,8 +164,7 @@ int do_pca953x(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (!c || !((argc == (c->maxargs)) ||
(((int)c->cmd == PCA953X_CMD_DEVICE) &&
(argc == (c->maxargs - 1))))) {
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
/* arg2 used as chip number or pin number */

View File

@ -294,8 +294,7 @@ int do_ds4510(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (!c || !((argc == (c->maxargs)) ||
(((int)c->cmd == DS4510_CMD_DEVICE) &&
(argc == (c->maxargs - 1))))) {
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
/* arg2 used as chip addr and pin number */
@ -366,14 +365,12 @@ int do_ds4510(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#ifdef CONFIG_CMD_DS4510_MEM
/* Only eeprom, seeprom, and sram commands should make it here */
if (strcmp(argv[2], "read") == 0) {
if (strcmp(argv[2], "read") == 0)
rw_func = ds4510_mem_read;
} else if (strcmp(argv[2], "write") == 0) {
else if (strcmp(argv[2], "write") == 0)
rw_func = ds4510_mem_write;
} else {
cmd_usage(cmdtp);
return 1;
}
else
return cmd_usage(cmdtp);
addr = simple_strtoul(argv[3], NULL, 16);
off += simple_strtoul(argv[4], NULL, 16);

View File

@ -163,26 +163,22 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
u32 val;
/* at least two arguments please */
if (argc < 2) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 2)
return cmd_usage(cmdtp);
cmd = argv[1];
if (strcmp(cmd, "dump") == 0) {
if (argc < 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 3)
return cmd_usage(cmdtp);
nregs = simple_strtoul(argv[2], NULL, 16);
pmic_dump(nregs);
return 0;
}
if (strcmp(cmd, "write") == 0) {
if (argc < 4) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 4)
return cmd_usage(cmdtp);
nregs = simple_strtoul(argv[2], NULL, 16);
val = simple_strtoul(argv[3], NULL, 16);
pmic_reg_write(nregs, val);

View File

@ -440,10 +440,8 @@ static int qe_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
ulong addr;
if (argc < 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 3)
return cmd_usage(cmdtp);
if (strcmp(argv[1], "fw") == 0) {
addr = simple_strtoul(argv[2], NULL, 16);
@ -471,8 +469,7 @@ static int qe_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return qe_upload_firmware((const struct qe_firmware *) addr);
}
cmd_usage(cmdtp);
return 1;
return cmd_usage(cmdtp);
}
U_BOOT_CMD(

View File

@ -121,10 +121,8 @@ int do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
int n, sect_first, sect_last;
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) {
@ -146,10 +144,8 @@ int do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
return rcode;
}
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);
@ -167,10 +163,8 @@ int do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
addr_first = simple_strtoul(argv[1], NULL, 16);
addr_last = simple_strtoul(argv[2], NULL, 16);
if (addr_first >= addr_last) {
cmd_usage(cmdtp);
return 1;
}
if (addr_first >= addr_last)
return cmd_usage(cmdtp);
printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last);
rcode = flash_sect_erase(addr_first, addr_last);
@ -243,19 +237,15 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
int i, p, n, sect_first, sect_last;
int rcode = 0;
if (argc < 3) {
cmd_usage(cmdtp);
return 1;
}
if (argc < 3)
return cmd_usage(cmdtp);
if (strcmp(argv[1], "off") == 0)
p = 0;
else if (strcmp(argv[1], "on") == 0)
p = 1;
else {
cmd_usage(cmdtp);
return 1;
}
else
return cmd_usage(cmdtp);
if (strcmp(argv[2], "all") == 0) {
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
@ -309,10 +299,8 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
return rcode;
}
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);
@ -340,7 +328,8 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
}
#if defined(CONFIG_SYS_FLASH_PROTECTION)
if (!rcode) puts (" done\n");
if (!rcode)
puts(" done\n");
#endif /* CONFIG_SYS_FLASH_PROTECTION */
return rcode;
@ -349,12 +338,10 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
addr_first = simple_strtoul(argv[2], NULL, 16);
addr_last = simple_strtoul(argv[3], NULL, 16);
if (addr_first >= addr_last) {
cmd_usage(cmdtp);
return 1;
}
rcode = flash_sect_protect (p, addr_first, addr_last);
return rcode;
if (addr_first >= addr_last)
return cmd_usage(cmdtp);
return flash_sect_protect (p, addr_first, addr_last);
}
int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
{