diff options
author | Wolfgang Denk <wd@denx.de> | 2010-07-17 01:06:04 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-07-24 20:43:57 +0200 |
commit | 47e26b1bf91ddef69f4a3892815c857db094cef9 (patch) | |
tree | 7d688085d23779707c637703273f79bd3cca83e0 /board | |
parent | debb6299ac1180a08f29f88c6d782b21a9c98707 (diff) | |
download | u-boot-47e26b1bf91ddef69f4a3892815c857db094cef9.tar.gz u-boot-47e26b1bf91ddef69f4a3892815c857db094cef9.tar.xz u-boot-47e26b1bf91ddef69f4a3892815c857db094cef9.zip |
cmd_usage(): simplify return code handling
Lots of code use this construct:
cmd_usage(cmdtp);
return 1;
Change cmd_usage() let it return 1 - then we can replace all these
ocurrances by
return cmd_usage(cmdtp);
This fixes a few places with incorrect return code handling, too.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board')
33 files changed, 140 insertions, 250 deletions
diff --git a/board/amcc/acadia/cmd_acadia.c b/board/amcc/acadia/cmd_acadia.c index 86f86e2b18..6936e51040 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 c0368c0389..c09d730888 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 3c0dc5f896..7f75ad7dee 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 595dee3fcc..9b2afdabca 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 1682cf7c6a..dd2aba546c 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 6a049dfbad..7f7730a81d 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 cde13e424b..e9cd333f3a 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 b8d968b915..6ce3480782 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 621980dfce..ba0c36770e 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 9109b64a1c..3dfbf3bc91 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 aa7437695e..4946538f4b 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 5a8f4f5810..3929ad0aac 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 0b7f787e5d..781a7c8745 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 5dd0311d41..9a929413bd 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 637bb5a7b3..cf82f61ef7 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 3a33b5a511..d7cbd7a2a9 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 61a1e1417f..9d6c21f73a 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 3948c13b64..ec113e7f56 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 a3722b2024..b4343d81de 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 199def4678..4a91458e8e 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 d7adff2f8e..a61e9451aa 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 29a095d738..e3abeb8ef1 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 73294351ba..692160cea8 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 3f2deed1e2..83b79148cb 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 dae01ec773..e15013f2fc 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 44247c850f..6d92c8362e 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 5660c09148..ef8bfde7f1 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 14d75ea429..97952844f9 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 d99036bef3..0562222ac8 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 0db705049f..0789c5848e 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 6d23470f84..ca4415c0b9 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 fede2e0774..fd623df25f 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 44d40eed28..cab9881ad8 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) |