From patchwork Thu Jul 11 13:38:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 258456 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 B05212C030C for ; Thu, 11 Jul 2013 23:38:35 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D9E8A4A1C9; Thu, 11 Jul 2013 15:38:31 +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 4GinwrN3dD37; Thu, 11 Jul 2013 15:38:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 167574A19F; Thu, 11 Jul 2013 15:38:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 582FD4A19F for ; Thu, 11 Jul 2013 15:38:21 +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 8+F-WOppAFfm for ; Thu, 11 Jul 2013 15:38:15 +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-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by theia.denx.de (Postfix) with ESMTPS id 2E42E4A19A for ; Thu, 11 Jul 2013 15:38:08 +0200 (CEST) Received: by mail-qc0-f182.google.com with SMTP id e10so4249838qcy.41 for ; Thu, 11 Jul 2013 06:38:06 -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=FoldqsknzexHPjOPTBaVFzaUvaroOX9x58fw1A+SJAY=; b=BlGwReudAN2CHZ6PC+wQHSk+O6PJ6u5uX63tTIxvsHQ13+ojIq+gCZIbFL36EoLNQD VYfsqUczsPw+TANg5hkHOi8Txtj6tdPPGyQv1DaWikNeTZsYHvg8U7wPoFMl4XUmQlnC H2/uhMwi+7FLTMBOy5yX2jmN32v8MPiiz6m5GRN54sXmcBovOPZ106woAtnx+yM9lEoN nqc4psIYBagMwX9cSFU5HLSHdQhDYsYlv76AKsnU4/kX7tOzs1ueFRf9+Akt/ZzUEcbI JcBHEWHj85bLXtMK5yRTpWifuRjvhGceK0HmI4TGLXMunk/zW7xLwmxIdlU+JXBfMeTm XBrg== X-Received: by 10.224.13.202 with SMTP id d10mr33790349qaa.19.1373549886206; Thu, 11 Jul 2013 06:38:06 -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 15sm29591870qaa.9.2013.07.11.06.38.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Jul 2013 06:38:05 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Thu, 11 Jul 2013 09:38:04 -0400 Message-Id: <1373549884-17765-1-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 Subject: [U-Boot] [PATCH] cmd_bootm.c: Re-order bootm_load_os return check for ELDK4.2 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 ELDK4.2 we were getting a warning that load_end may be used uninitialized in calling lmb_reserve. This could not be the case, however. If we re-order the checks (and make them slightly clearer as well) the warning goes away. bootm_load_os may only return 0 on success, BOOTM_ERR_OVERLAP in a non-fatal overlap (already covered in comments) or a fatal BOOTM_ERR that is covered in the error handler. Signed-off-by: Tom Rini --- common/cmd_bootm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 6caa0e9..d5b2a3c 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -650,12 +650,11 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, iflag = bootm_disable_interrupts(); ret = bootm_load_os(images, &load_end, 0); - if (ret && ret != BOOTM_ERR_OVERLAP) - goto err; - if (ret == 0) lmb_reserve(&images->lmb, images->os.load, (load_end - images->os.load)); + else if (ret && ret != BOOTM_ERR_OVERLAP) + goto err; else if (ret == BOOTM_ERR_OVERLAP) ret = 0; }