From patchwork Mon Jul 1 13:09:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 256125 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 BD0922C008F for ; Mon, 1 Jul 2013 23:09:47 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2C9B14A23C; Mon, 1 Jul 2013 15:09:46 +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 PXND0vp6G9Sa; Mon, 1 Jul 2013 15:09:45 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE9A14A20F; Mon, 1 Jul 2013 15:09:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 74A374A20F for ; Mon, 1 Jul 2013 15:09:36 +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 KGhemxImQ0fA for ; Mon, 1 Jul 2013 15:09:30 +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-gh0-f175.google.com (mail-gh0-f175.google.com [209.85.160.175]) by theia.denx.de (Postfix) with ESMTPS id 2EB324A20D for ; Mon, 1 Jul 2013 15:09:23 +0200 (CEST) Received: by mail-gh0-f175.google.com with SMTP id z19so1952207ghb.20 for ; Mon, 01 Jul 2013 06:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer; bh=xVu3TUEZ7N93cfSNpTvu1JI1GlFY2bibeG3vRh6tC9Y=; b=AyhAFTulDOAevVcPRGH5AvPVSRB3RZEFL9awyrRkhjR7xgkxvDQM4uFtJlXTPKAm30 LHait2ufE/sJ1vp3DG8d6p/FNX33GVEVwyplu0Q6DRyfItzyi8jh2FNAqCzSBJDt0/Hq jLPpPrZQW2sR1cYZrxuOsMBwgR17Cf42NlGuZ81K6Vk6of7jEdBopQBZn6Fk5vrlSBXa idHCLMxUNgKQgvpgknVmZGPb5KWcc+ZN7nLLqMaQHtu0no5FjsLWzjmiQ0pKlXekALr0 +e3b67zbIjdRUcg13PJFNLUs+mzJ61168wAdoieToLosJdBoDLyNkAgd90Dh2rySdo4t 4+jA== X-Received: by 10.236.174.199 with SMTP id x47mr12198400yhl.257.1372684161707; Mon, 01 Jul 2013 06:09:21 -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 x52sm33053351yhh.18.2013.07.01.06.09.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Jul 2013 06:09:21 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Mon, 1 Jul 2013 09:09:23 -0400 Message-Id: <1372684164-18426-1-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 Subject: [U-Boot] [PATCH] cmd_bootm.c: Correct check/return for unsupported sub-command 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 With the do_bootm_states re-organization, we have the call to any potential sub-commands in a single spot. If one fails, we can then stop right there and return to the caller. Prior to these calls we have already ensured that ret is zero so we will not be returning this error for some other case. Signed-off-by: Tom Rini Tested-by: Andreas Bießmann --- common/cmd_bootm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 02a5013..a36e019 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -669,6 +669,13 @@ 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)) { @@ -699,8 +706,6 @@ err: bootstage_error(BOOTSTAGE_ID_DECOMP_UNIMPL); else if (ret == BOOTM_ERR_RESET) do_reset(cmdtp, flag, argc, argv); - else - puts("subcommand not supported\n"); return ret; }