From patchwork Fri Dec 4 22:27:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 57731 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp830200lbb; Fri, 4 Dec 2015 14:28:21 -0800 (PST) X-Received: by 10.28.4.212 with SMTP id 203mr7881714wme.89.1449268101809; Fri, 04 Dec 2015 14:28:21 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id v12si14641544wjr.84.2015.12.04.14.28.21; Fri, 04 Dec 2015 14:28:21 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 025D64B70A; Fri, 4 Dec 2015 23:28:15 +0100 (CET) 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 eP5Ayy0Gvxao; Fri, 4 Dec 2015 23:28:14 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0EA734B6CD; Fri, 4 Dec 2015 23:28:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1F03C4B656 for ; Fri, 4 Dec 2015 23:27:51 +0100 (CET) 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 rvtoCfnMdWDI for ; Fri, 4 Dec 2015 23:27:51 +0100 (CET) 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 bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by theia.denx.de (Postfix) with ESMTPS id D5AF24B668 for ; Fri, 4 Dec 2015 23:27:50 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 4B660264400 Received: by dusk.luon.net (Postfix, from userid 1000) id E3626203CB; Fri, 4 Dec 2015 23:27:41 +0100 (CET) From: Sjoerd Simons To: Simon Glass Date: Fri, 4 Dec 2015 23:27:36 +0100 Message-Id: <1449268061-805-3-git-send-email-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1449268061-805-1-git-send-email-sjoerd.simons@collabora.co.uk> References: <1449268061-805-1-git-send-email-sjoerd.simons@collabora.co.uk> MIME-Version: 1.0 Cc: Pantelis Antoniou , u-boot@lists.denx.de, Guillaume GARDET , Stefan Roese Subject: [U-Boot] [PATCH 2/7] spl: mmc: Explicitly init mmc struct X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" gcc fails to work out that the mmc variable will only ever be used if it has been initialized by spl_mmc_get_device_index and throws the following error: common/spl/spl_mmc.c: In function ‘spl_mmc_load_image’: common/spl/spl_mmc.c:31:24: warning: ‘mmc’ may be used uninitialized in this function [-Wmaybe-uninitialized] count = mmc->block_dev.block_read(0, sector, 1, header); ^ common/spl/spl_mmc.c:251:14: note: ‘mmc’ was declared here struct mmc *mmc; Prevent this by explicitly initializing the variable. Signed-off-by: Sjoerd Simons --- common/spl/spl_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index b3c2c64..43748d0 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -248,7 +248,7 @@ int spl_mmc_do_fs_boot(struct mmc *mmc) int spl_mmc_load_image(u32 boot_device) { - struct mmc *mmc; + struct mmc *mmc = NULL; u32 boot_mode; int err = 0; __maybe_unused int part;