From patchwork Thu Jul 4 20:26:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 256996 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 3360A2C0096 for ; Fri, 5 Jul 2013 06:27:24 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 703874A04F; Thu, 4 Jul 2013 22:27:16 +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 1-LySviGh+Db; Thu, 4 Jul 2013 22:27:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BE98F4A052; Thu, 4 Jul 2013 22:27:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 553534A02A for ; Thu, 4 Jul 2013 22:26:53 +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 CIxwORMbFibr for ; Thu, 4 Jul 2013 22:26:48 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=ERR(-1.5) (only DNSBL check requested) Received: from mail-vc0-f202.google.com (mail-vc0-f202.google.com [209.85.220.202]) by theia.denx.de (Postfix) with ESMTPS id A87764A02D for ; Thu, 4 Jul 2013 22:26:35 +0200 (CEST) Received: by mail-vc0-f202.google.com with SMTP id ha12so135442vcb.1 for ; Thu, 04 Jul 2013 13:26:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=glo7d0TNvgyHTepSuEl/PNfPX3KHOVvlCEHLYtSmUW8=; b=jaQr9HPQECGPFYKshs2uXJvV1d0zTuhXfFJpAu7iOSJtF35EN7gx0x3IypSkoqPY8V V/HswIVosxmWKqUab9fa4jqWMNHnzgjAosEi7Z+V6ifvV0uoqmxfy+kfQoZSaipNn7Xo 3ENbbucHRdTUKEz9ZZY/W6n3JXA++Bjnrii/3cSlVqcYIbOUTNGz4GhfYVcQPch9Zb/l Crwf0+n7XcuZF5g3M8766DAqnsQQS+elHENcqtPjmkyyFb/KF8iy1crRv76D6NGRw8je PjMnG5ppf8WsTa1+nmzO1gXaxM2El/3pog1bd+pBfqliA+bQsTfW4r7xABQ+MxUO1leE ya6Q== X-Received: by 10.236.124.78 with SMTP id w54mr3574846yhh.44.1372969594575; Thu, 04 Jul 2013 13:26:34 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id n70si292866yhj.7.2013.07.04.13.26.34 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Thu, 04 Jul 2013 13:26:34 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 6A2325A41B3; Thu, 4 Jul 2013 13:26:34 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 1C43C1603A8; Thu, 4 Jul 2013 13:26:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Thu, 4 Jul 2013 13:26:09 -0700 Message-Id: <1372969571-17043-3-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.3 In-Reply-To: <1372969571-17043-2-git-send-email-sjg@chromium.org> References: <1372969571-17043-2-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQnMhITmKwsFlL+pfU9vhtW6daKA4511wUiatES9Qv2ce8o3SKj8mzCbgLJV4XOZ4VjmjUmo0QbXQ1fJw+xccXE+mbuCBN80lXT3dBd+XWXUoJGSrVYwpSfwzXhqyrA78eKpD2n5ISi97J2fT/rjGegeHiSMqygv8BFJsvpyT1X0dl4iwKi7Fj28/mEw5BE89eQ5VwC9 Cc: Tom Rini Subject: [U-Boot] [PATCH v2 3/5] bootm: Require boot function only if it is about to be used 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 The original bootm code (before commit 35fc84f) did not check for a valid boot function in the subcommand case, which was incorrect. This check was introduced in all cases, but in fact we should only check for the function when we need it. Otherwise in some cases the check fires before the OS type is known. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to limit checking of rboot function validity common/cmd_bootm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 0c88be1..63cbfae 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -605,7 +605,7 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, { boot_os_fn *boot_fn; ulong iflag = 0; - int ret = 0; + int ret = 0, need_boot_fn; images->state |= states; @@ -665,7 +665,10 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, if (ret) return ret; boot_fn = boot_os[images->os.os]; - if (boot_fn == NULL) { + need_boot_fn = states & (BOOTM_STATE_OS_CMDLINE | + BOOTM_STATE_OS_BD_T | BOOTM_STATE_OS_PREP | + BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO); + if (boot_fn == NULL && need_boot_fn) { if (iflag) enable_interrupts(); printf("ERROR: booting os '%s' (%d) is not supported\n",