From patchwork Wed Jul 10 13:25:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 258048 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 58FD42C02CE for ; Wed, 10 Jul 2013 23:26:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 17E534A179; Wed, 10 Jul 2013 15:26:00 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OWjQ--+lLyyJ; Wed, 10 Jul 2013 15:25:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 84D844A0AE; Wed, 10 Jul 2013 15:25:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6C2AC4A047 for ; Wed, 10 Jul 2013 15:25:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8jTZjhZt5ojY for ; Wed, 10 Jul 2013 15:25:44 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-qc0-f177.google.com (mail-qc0-f177.google.com [209.85.216.177]) by theia.denx.de (Postfix) with ESMTPS id 46D864A134 for ; Wed, 10 Jul 2013 15:25:37 +0200 (CEST) Received: by mail-qc0-f177.google.com with SMTP id n1so3553741qcx.8 for ; Wed, 10 Jul 2013 06:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=VeoDP6LduGlCaanyyawMnnUBF9mQZIk9aCQRHS7o3Fg=; b=myWGUZYK+Lu6zZJmU4WYL2LxXGFZHrCDjNo1zMj9rqMUTIqebMebYuPGu2t1YmO6ki 2/LLAfvt65xRbGapDlcLFYIz3Y9BN00OFe/z4Kpw33IIp72lHbXhn3xP3aBHgPaRXVyT NqijLL0HWtl8hMG3uwq0BdwYMJkYU6It9x9BvQvFMKUzHD3LzUlGLTziF8YdyfY33kRc MXHlBbZEnd6RW4Lp+qpjZaKDizFm29jzHxh0+x5uZNshxI2jUMYmbJ9n5okiFfrGjQal zXPs7mAh7I1IggdM/IjDIfyd1LPpvl8WWSzLC76tB1ggtWfhXBY29++aw1NG7vByhvGp WbgA== X-Received: by 10.229.72.4 with SMTP id k4mr5927741qcj.106.1373462736427; Wed, 10 Jul 2013 06:25:36 -0700 (PDT) Received: from localhost.localdomain (cpe-065-184-250-089.ec.res.rr.com. [65.184.250.89]) by mx.google.com with ESMTPSA id m2sm24543966qat.2.2013.07.10.06.25.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Jul 2013 06:25:35 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Wed, 10 Jul 2013 09:25:33 -0400 Message-Id: <1373462733-15054-1-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 Subject: [U-Boot] [PATCH v3] bootm: Handle errors consistently X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Simon Glass 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 [trini: Update slightly based on Simon's changes to also cover CONFIG_TRACE/BOOTM_STATE_FAKE_OS_GO] Signed-off-by: Tom Rini --- common/cmd_bootm.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index a783cea..6caa0e9 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -705,13 +705,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)) { @@ -723,15 +716,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: