summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2013-07-10 09:25:33 -0400
committerTom Rini <trini@ti.com>2013-07-12 17:16:37 -0400
commitb7a1d13462115d2cafb0a3ffcbdce48c2f78f06e (patch)
tree8b0e8e7bbc4652ed3b6d951fea642725d80f4dbf
parente3a5bbce4590fbe18daae51087cd5cf4d2246bb9 (diff)
downloadu-boot-imx-b7a1d13462115d2cafb0a3ffcbdce48c2f78f06e.zip
u-boot-imx-b7a1d13462115d2cafb0a3ffcbdce48c2f78f06e.tar.gz
u-boot-imx-b7a1d13462115d2cafb0a3ffcbdce48c2f78f06e.tar.bz2
bootm: Handle errors consistently
A recent bootm fix left the error path incomplete. If CONFIG_TRACE is set it may still not be a supported command, so cover that with the unsupported subcommand print. Once we handle BOOTM_STATE_OS_GO, we can just move into the error handler itself, no need for a goto there. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Update slightly based on Simon's changes to also cover CONFIG_TRACE/BOOTM_STATE_FAKE_OS_GO] Signed-off-by: Tom Rini <trini@ti.com>
-rw-r--r--common/cmd_bootm.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 2694c66..c18157c 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -703,13 +703,6 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,
if (!ret && (states & BOOTM_STATE_OS_PREP))
ret = boot_fn(BOOTM_STATE_OS_PREP, argc, argv, images);
- /* Check for unsupported subcommand. */
- if (ret) {
- puts("subcommand not supported\n");
- return ret;
- }
-
-
#ifdef CONFIG_TRACE
/* Pretend to run the OS, then run a user command */
if (!ret && (states & BOOTM_STATE_OS_FAKE_GO)) {
@@ -721,15 +714,17 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,
ret = run_command_list(cmd_list, -1, flag);
}
#endif
+
+ /* Check for unsupported subcommand. */
+ if (ret) {
+ puts("subcommand not supported\n");
+ return ret;
+ }
+
/* Now run the OS! We hope this doesn't return */
- if (!ret && (states & BOOTM_STATE_OS_GO)) {
+ if (!ret && (states & BOOTM_STATE_OS_GO))
ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_GO,
images, boot_fn);
- if (ret)
- goto err;
- }
-
- return ret;
/* Deal with any fallout */
err: