summaryrefslogtreecommitdiff
path: root/board/amcc
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-07-17 01:06:04 +0200
committerWolfgang Denk <wd@denx.de>2010-07-24 20:43:57 +0200
commit47e26b1bf91ddef69f4a3892815c857db094cef9 (patch)
tree7d688085d23779707c637703273f79bd3cca83e0 /board/amcc
parentdebb6299ac1180a08f29f88c6d782b21a9c98707 (diff)
downloadu-boot-imx-47e26b1bf91ddef69f4a3892815c857db094cef9.zip
u-boot-imx-47e26b1bf91ddef69f4a3892815c857db094cef9.tar.gz
u-boot-imx-47e26b1bf91ddef69f4a3892815c857db094cef9.tar.bz2
cmd_usage(): simplify return code handling
Lots of code use this construct: cmd_usage(cmdtp); return 1; Change cmd_usage() let it return 1 - then we can replace all these ocurrances by return cmd_usage(cmdtp); This fixes a few places with incorrect return code handling, too. Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board/amcc')
-rw-r--r--board/amcc/acadia/cmd_acadia.c6
-rw-r--r--board/amcc/luan/luan.c3
-rw-r--r--board/amcc/makalu/cmd_pll.c13
-rw-r--r--board/amcc/taihu/lcd.c20
-rw-r--r--board/amcc/taihu/taihu.c15
-rw-r--r--board/amcc/taishan/lcd.c20
-rw-r--r--board/amcc/yucca/cmd_yucca.c6
7 files changed, 32 insertions, 51 deletions
diff --git a/board/amcc/acadia/cmd_acadia.c b/board/amcc/acadia/cmd_acadia.c
index 86f86e2..6936e51 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 c0368c0..c09d730 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 3c0dc5f..7f75ad7 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 595dee3..9b2afda 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 1682cf7..dd2aba5 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 6a049df..7f7730a 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 cde13e4..e9cd333 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;