diff options
89 files changed, 454 insertions, 833 deletions
diff --git a/arch/powerpc/cpu/mpc512x/diu.c b/arch/powerpc/cpu/mpc512x/diu.c index f638c003722..9ef5609f31f 100644 --- a/arch/powerpc/cpu/mpc512x/diu.c +++ b/arch/powerpc/cpu/mpc512x/diu.c @@ -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) diff --git a/arch/powerpc/cpu/mpc8260/bedbug_603e.c b/arch/powerpc/cpu/mpc8260/bedbug_603e.c index 248861289bb..89193a348e0 100644 --- a/arch/powerpc/cpu/mpc8260/bedbug_603e.c +++ b/arch/powerpc/cpu/mpc8260/bedbug_603e.c @@ -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 ); diff --git a/arch/powerpc/cpu/mpc83xx/ecc.c b/arch/powerpc/cpu/mpc83xx/ecc.c index 8dadd64b425..f8eab96b199 100644 --- a/arch/powerpc/cpu/mpc83xx/ecc.c +++ b/arch/powerpc/cpu/mpc83xx/ecc.c @@ -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, diff --git a/arch/powerpc/cpu/mpc8xx/bedbug_860.c b/arch/powerpc/cpu/mpc8xx/bedbug_860.c index 9deda6c2a08..83db035ab51 100644 --- a/arch/powerpc/cpu/mpc8xx/bedbug_860.c +++ b/arch/powerpc/cpu/mpc8xx/bedbug_860.c @@ -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; diff --git a/board/amcc/acadia/cmd_acadia.c b/board/amcc/acadia/cmd_acadia.c index 86f86e2b185..6936e510402 100644 --- a/board/amcc/acadia/cmd_acadia.c +++ b/board/amcc/acadia/cmd_acadia.c @@ -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) { diff --git a/board/amcc/luan/luan.c b/board/amcc/luan/luan.c index c0368c0389f..c09d7308888 100644 --- a/board/amcc/luan/luan.c +++ b/board/amcc/luan/luan.c @@ -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; diff --git a/board/amcc/makalu/cmd_pll.c b/board/amcc/makalu/cmd_pll.c index 3c0dc5f8969..7f75ad7deec 100644 --- a/board/amcc/makalu/cmd_pll.c +++ b/board/amcc/makalu/cmd_pll.c @@ -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, " diff --git a/board/amcc/taihu/lcd.c b/board/amcc/taihu/lcd.c index 595dee3fcc4..9b2afdabca5 100644 --- a/board/amcc/taihu/lcd.c +++ b/board/amcc/taihu/lcd.c @@ -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) { diff --git a/board/amcc/taihu/taihu.c b/board/amcc/taihu/taihu.c index 1682cf7c6ad..dd2aba546c1 100644 --- a/board/amcc/taihu/taihu.c +++ b/board/amcc/taihu/taihu.c @@ -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; diff --git a/board/amcc/taishan/lcd.c b/board/amcc/taishan/lcd.c index 6a049dfbadc..7f7730a81d1 100644 --- a/board/amcc/taishan/lcd.c +++ b/board/amcc/taishan/lcd.c @@ -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) { diff --git a/board/amcc/yucca/cmd_yucca.c b/board/amcc/yucca/cmd_yucca.c index cde13e424b5..e9cd333f3a5 100644 --- a/board/amcc/yucca/cmd_yucca.c +++ b/board/amcc/yucca/cmd_yucca.c @@ -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; diff --git a/board/barco/barco.c b/board/barco/barco.c index b8d968b9153..6ce3480782b 100644 --- a/board/barco/barco.c +++ b/board/barco/barco.c @@ -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; diff --git a/board/digsy_mtc/cmd_mtc.c b/board/digsy_mtc/cmd_mtc.c index 621980dfce7..ba0c36770e1 100644 --- a/board/digsy_mtc/cmd_mtc.c +++ b/board/digsy_mtc/cmd_mtc.c @@ -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; diff --git a/board/esd/common/lcd.c b/board/esd/common/lcd.c index 9109b64a1ce..3dfbf3bc913 100644 --- a/board/esd/common/lcd.c +++ b/board/esd/common/lcd.c @@ -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); diff --git a/board/esd/dasa_sim/cmd_dasa_sim.c b/board/esd/dasa_sim/cmd_dasa_sim.c index aa7437695eb..4946538f4bb 100644 --- a/board/esd/dasa_sim/cmd_dasa_sim.c +++ b/board/esd/dasa_sim/cmd_dasa_sim.c @@ -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( diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c index 5a8f4f5810a..3929ad0aac3 100644 --- a/board/freescale/common/sys_eeprom.c +++ b/board/freescale/common/sys_eeprom.c @@ -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; diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c index 0b7f787e5d4..781a7c87454 100644 --- a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c +++ b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c @@ -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) diff --git a/board/hymod/bsp.c b/board/hymod/bsp.c index 5dd0311d419..9a929413bd0 100644 --- a/board/hymod/bsp.c +++ b/board/hymod/bsp.c @@ -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); diff --git a/board/inka4x0/inkadiag.c b/board/inka4x0/inkadiag.c index 637bb5a7b3b..cf82f61ef70 100644 --- a/board/inka4x0/inkadiag.c +++ b/board/inka4x0/inkadiag.c @@ -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); } } diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 3a33b5a5114..d7cbd7a2a99 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -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; diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c index 61a1e1417fe..9d6c21f73ae 100644 --- a/board/lwmon/lwmon.c +++ b/board/lwmon/lwmon.c @@ -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( diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c index 3948c13b646..ec113e7f56f 100644 --- a/board/lwmon5/lwmon5.c +++ b/board/lwmon5/lwmon5.c @@ -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; } diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c index a3722b2024d..b4343d81ded 100644 --- a/board/mpl/common/common_util.c +++ b/board/mpl/common/common_util.c @@ -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); } diff --git a/board/pcippc2/pcippc2.c b/board/pcippc2/pcippc2.c index 199def46787..4a91458e8e6 100644 --- a/board/pcippc2/pcippc2.c +++ b/board/pcippc2/pcippc2.c @@ -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( diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c index d7adff2f8e6..a61e9451aa4 100644 --- a/board/pcs440ep/pcs440ep.c +++ b/board/pcs440ep/pcs440ep.c @@ -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) { diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c index 29a095d738b..e3abeb8ef1e 100644 --- a/board/pdm360ng/pdm360ng.c +++ b/board/pdm360ng/pdm360ng.c @@ -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]); } diff --git a/board/pn62/cmd_pn62.c b/board/pn62/cmd_pn62.c index 73294351bae..692160cea8a 100644 --- a/board/pn62/cmd_pn62.c +++ b/board/pn62/cmd_pn62.c @@ -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"); diff --git a/board/prodrive/pdnb3/pdnb3.c b/board/prodrive/pdnb3/pdnb3.c index 3f2deed1e2b..83b79148cb6 100644 --- a/board/prodrive/pdnb3/pdnb3.c +++ b/board/prodrive/pdnb3/pdnb3.c @@ -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); diff --git a/board/renesas/sh7785lcr/rtl8169_mac.c b/board/renesas/sh7785lcr/rtl8169_mac.c index dae01ec7735..e15013f2fcb 100644 --- a/board/renesas/sh7785lcr/rtl8169_mac.c +++ b/board/renesas/sh7785lcr/rtl8169_mac.c @@ -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(); diff --git a/board/renesas/sh7785lcr/selfcheck.c b/board/renesas/sh7785lcr/selfcheck.c index 44247c850fe..6d92c8362e7 100644 --- a/board/renesas/sh7785lcr/selfcheck.c +++ b/board/renesas/sh7785lcr/selfcheck.c @@ -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; diff --git a/board/siemens/common/fpga.c b/board/siemens/common/fpga.c index 5660c09148e..ef8bfde7f1d 100644 --- a/board/siemens/common/fpga.c +++ b/board/siemens/common/fpga.c @@ -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( diff --git a/board/siemens/pcu_e/pcu_e.c b/board/siemens/pcu_e/pcu_e.c index 14d75ea4296..97952844f94 100644 --- a/board/siemens/pcu_e/pcu_e.c +++ b/board/siemens/pcu_e/pcu_e.c @@ -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, diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c index d99036bef3e..0562222ac82 100644 --- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -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, diff --git a/board/tqc/tqm5200/cmd_stk52xx.c b/board/tqc/tqm5200/cmd_stk52xx.c index 0db705049ff..0789c5848eb 100644 --- a/board/tqc/tqm5200/cmd_stk52xx.c +++ b/board/tqc/tqm5200/cmd_stk52xx.c @@ -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) { diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c index 6d23470f84b..ca4415c0b92 100644 --- a/board/trab/cmd_trab.c +++ b/board/trab/cmd_trab.c @@ -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) { diff --git a/board/trizepsiv/eeprom.c b/board/trizepsiv/eeprom.c index fede2e07747..fd623df25f2 100644 --- a/board/trizepsiv/eeprom.c +++ b/board/trizepsiv/eeprom.c @@ -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( diff --git a/board/w7o/cmd_vpd.c b/board/w7o/cmd_vpd.c index 44d40eed287..cab9881ad8c 100644 --- a/board/w7o/cmd_vpd.c +++ b/board/w7o/cmd_vpd.c @@ -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) diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c index d01ee19ee58..2bd62e24381 100644 --- a/common/cmd_bedbug.c +++ b/common/cmd_bedbug.c @@ -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); diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index 5ec798c549a..d51cc554c19 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -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( diff --git a/common/cmd_boot.c b/common/cmd_boot.c index 9ccc8c798dd..72dacaaf7a7 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -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); diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index bf77fb463d3..adfa6cd18ae 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -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; diff --git a/common/cmd_cache.c b/common/cmd_cache.c index be87b5c2d7c..5cdd8341f28 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -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; diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c index 45de8cd65a8..45fe66a7eeb 100644 --- a/common/cmd_dcr.c +++ b/common/cmd_dcr.c @@ -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); diff --git a/common/cmd_df.c b/common/cmd_df.c index 6a086663bff..9a3c84c38ca 100644 --- a/common/cmd_df.c +++ b/common/cmd_df.c @@ -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( diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index 129162c0151..9f4b22c553a 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -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 diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c index 49021cdb86c..35fb36194c9 100644 --- a/common/cmd_ext2.c +++ b/common/cmd_ext2.c @@ -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) { diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c index 486d5d48447..831a07f2c18 100644 --- a/common/cmd_fdc.c +++ b/common/cmd_fdc.c @@ -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) { diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index 00f7e88e127..a8822d91b07 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -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 */ diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index cd4c6de6da6..3d0c2b772c9 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -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; diff --git a/common/cmd_flash.c b/common/cmd_flash.c index 5d8fb7a8361..ff43965e9c0 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -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; diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index ddc7a05a5b8..e50c9de876a 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 @@ 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. diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index fb9d3b038fa..371e022f79e 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -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); } /***************************************************/ diff --git a/common/cmd_ide.c b/common/cmd_ide.c index d486697bb4a..c0fb88dbc79 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -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); diff --git a/common/cmd_irq.c b/common/cmd_irq.c index 48883289fc0..d35a43fc5e9 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 e88d6e097c6..8dd8927b580 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -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. diff --git a/common/cmd_load.c b/common/cmd_load.c index 52ed1fa70d7..dad03037a08 100644 --- a/common/cmd_load.c +++ b/common/cmd_load.c @@ -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; diff --git a/common/cmd_log.c b/common/cmd_log.c index 49deddd7f99..0e89357e5dc 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -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); } } diff --git a/common/cmd_mem.c b/common/cmd_mem.c index bcea3992dbc..44834ea7514 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -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); diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index eeef2cddab6..00180b0f2ce 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -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) { diff --git a/common/cmd_mii.c b/common/cmd_mii.c index 1619a2583a2..bb941862db6 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -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); } /* diff --git a/common/cmd_misc.c b/common/cmd_misc.c index 8439da2f7d3..061b1bbad01 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -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); } diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 698157f6b85..e5f5e944daf 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -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; diff --git a/common/cmd_mp.c b/common/cmd_mp.c index 4d7b871528d..f19bf41f8eb 100644 --- a/common/cmd_mp.c +++ b/common/cmd_mp.c @@ -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; } diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 447486ba291..ceec5a97511 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -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); } /***************************************************/ diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 84b6272950d..0f47a258ce2 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -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); diff --git a/common/cmd_net.c b/common/cmd_net.c index 3cdb07fdc72..3ffb9df1de0 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -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: diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 13325bc8363..1198954bb50 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -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]); diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c index a3e46a338f3..83d967bd181 100644 --- a/common/cmd_onenand.c +++ b/common/cmd_onenand.c @@ -361,10 +361,7 @@ static int do_onenand_read(cmd_tbl_t * cmdtp, int flag, int argc, char * const a size_t retlen = 0; if (argc < 3) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); s = strchr(argv[0], '.'); if ((s != NULL) && (!strcmp(s, ".oob"))) @@ -391,10 +388,7 @@ static int do_onenand_write(cmd_tbl_t * cmdtp, int flag, int argc, char * const size_t retlen = 0; if (argc < 3) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); addr = (ulong)simple_strtoul(argv[1], NULL, 16); @@ -477,10 +471,7 @@ static int do_onenand_dump(cmd_tbl_t * cmdtp, int flag, int argc, char * const a char *s; if (argc < 2) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); s = strchr(argv[0], '.'); ofs = (int)simple_strtoul(argv[1], NULL, 16); @@ -502,10 +493,7 @@ static int do_onenand_markbad(cmd_tbl_t * cmdtp, int flag, int argc, char * cons argv += 2; if (argc <= 0) - { - cmd_usage(cmdtp); - return 1; - } + return cmd_usage(cmdtp); while (argc > 0) { addr = simple_strtoul(*argv, NULL, 16); @@ -549,12 +537,10 @@ static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[] c = find_cmd_tbl(argv[0], &cmd_onenand_sub[0], ARRAY_SIZE(cmd_onenand_sub)); - if (c) { - return c->cmd(cmdtp, flag, argc, argv); - } else { - cmd_usage(cmdtp); - return 1; - } + if (c) + return c->cmd(cmdtp, flag, argc, argv); + else + return cmd_usage(cmdtp); } U_BOOT_CMD( diff --git a/common/cmd_otp.c b/common/cmd_otp.c index a8c73b5a866..43f7c69f789 100644 --- a/common/cmd_otp.c +++ b/common/cmd_otp.c @@ -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; diff --git a/common/cmd_pci.c b/common/cmd_pci.c index 358ca60b814..4bde0599118 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -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); } /***************************************************/ diff --git a/common/cmd_portio.c b/common/cmd_portio.c index 92d61d206f2..4f2f4997b27 100644 --- a/common/cmd_portio.c +++ b/common/cmd_portio.c @@ -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); diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c index 2133a1fa4fd..ced1d40958e 100644 --- a/common/cmd_reiser.c +++ b/common/cmd_reiser.c @@ -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) { diff --git a/common/cmd_sata.c b/common/cmd_sata.c index 7be58e57c63..7efa8597ad4 100644 --- a/common/cmd_sata.c +++ b/common/cmd_sata.c @@ -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; diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index 5b2df28dd26..6b937f9ad33 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -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); } /**************************************************************************************** diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c index b3e489fbe3c..1ff12329bcc 100644 --- a/common/cmd_setexpr.c +++ b/common/cmd_setexpr.c @@ -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); diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 4826e9f5ffc..6e7be818ebe 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -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( diff --git a/common/cmd_strings.c b/common/cmd_strings.c index bbbb6b4da9f..144a6c18d7e 100644 --- a/common/cmd_strings.c +++ b/common/cmd_strings.c @@ -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); diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 2faf8d82ce8..77ca0a5f2e7 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -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; diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c index 9017041af45..2cab793e6c8 100644 --- a/common/cmd_ubifs.c +++ b/common/cmd_ubifs.c @@ -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); diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 73d74ac0558..dc63f244da4 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -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 diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c index 1429d311675..18c14d1f3bc 100644 --- a/common/cmd_vfd.c +++ b/common/cmd_vfd.c @@ -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); diff --git a/common/command.c b/common/command.c index a1fc592c247..30a9801d9f5 100644 --- a/common/command.c +++ b/common/command.c @@ -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 diff --git a/common/hush.c b/common/hush.c index 8a74d225e9d..4dd9513b036 100644 --- a/common/hush.c +++ b/common/hush.c @@ -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__ diff --git a/common/main.c b/common/main.c index 20090ee6aa7..54ef79e2649 100644 --- a/common/main.c +++ b/common/main.c @@ -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; diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index d1065f4f8e5..6e82bd66afb 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c @@ -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 */ diff --git a/drivers/misc/ds4510.c b/drivers/misc/ds4510.c index 5b33c1ffced..aa893c35fbb 100644 --- a/drivers/misc/ds4510.c +++ b/drivers/misc/ds4510.c @@ -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); diff --git a/drivers/misc/fsl_pmic.c b/drivers/misc/fsl_pmic.c index 274327f470c..dca0a1d57e7 100644 --- a/drivers/misc/fsl_pmic.c +++ b/drivers/misc/fsl_pmic.c @@ -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); diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c index 63cc68e3078..c4ec2f4af89 100644 --- a/drivers/qe/qe.c +++ b/drivers/qe/qe.c @@ -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( diff --git a/tools/updater/cmd_flash.c b/tools/updater/cmd_flash.c index 5ce45baeb44..957a7c4f685 100644 --- a/tools/updater/cmd_flash.c +++ b/tools/updater/cmd_flash.c @@ -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) { |