diff mbox

[U-Boot,1/3] Check run_command() return code properly

Message ID 1401832817-4152-2-git-send-email-thomas.betker@freenet.de
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Thomas Betker June 3, 2014, 10 p.m. UTC
From: Thomas Betker <thomas.betker@rohde-schwarz.com>

run_command() returns 0 for success, 1 for failure. Fix places which
assume that failure is indicated by a negative return code.

Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
---
 arch/arm/cpu/arm926ejs/kirkwood/cpu.c |    2 +-
 board/gdsys/p1022/controlcenterd.c    |    6 +-----
 common/cmd_bootm.c                    |    6 +-----
 3 files changed, 3 insertions(+), 11 deletions(-)

Comments

Simon Glass June 5, 2014, 3:07 a.m. UTC | #1
Hi Thomas,

On 3 June 2014 16:00, <thomas.betker@freenet.de> wrote:

> From: Thomas Betker <thomas.betker@rohde-schwarz.com>
>
> run_command() returns 0 for success, 1 for failure. Fix places which
> assume that failure is indicated by a negative return code.
>
> Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
>

This looks good but it has not appeared on patchwork. I'm not sure if it is
because you don't have a name attached to the email you are sending from.
Can you please try sending the series again?

I will send out a rudimentary test for this also (which failed before your
series and passes with it applied).

Regards,
Simon
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index 0937506..da80240 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -210,7 +210,7 @@  static void kw_sysrst_action(void)
 
 	debug("Starting %s process...\n", __FUNCTION__);
 	ret = run_command(s, 0);
-	if (ret < 0)
+	if (ret != 0)
 		debug("Error.. %s failed\n", __FUNCTION__);
 	else
 		debug("%s process finished\n", __FUNCTION__);
diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c
index 8ccd9ce..642b807 100644
--- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c
@@ -221,11 +221,7 @@  void hw_watchdog_reset(void)
 #ifdef CONFIG_TRAILBLAZER
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int rcode = 0;
-
-	if (run_command(getenv("bootcmd"), flag) < 0)
-		rcode = 1;
-	return rcode;
+	return run_command(getenv("bootcmd"), flag);
 }
 
 int board_early_init_r(void)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 449bb36..745fc65 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1079,11 +1079,7 @@  U_BOOT_CMD(
 #if defined(CONFIG_CMD_BOOTD)
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int rcode = 0;
-
-	if (run_command(getenv("bootcmd"), flag) < 0)
-		rcode = 1;
-	return rcode;
+	return run_command(getenv("bootcmd"), flag);
 }
 
 U_BOOT_CMD(