From patchwork Tue Aug 7 16:58:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 175751 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 1AF502C0090 for ; Wed, 8 Aug 2012 02:58:48 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DE6FF282F7; Tue, 7 Aug 2012 18:58:44 +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 Kz1U-I2TZahE; Tue, 7 Aug 2012 18:58:44 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A73D9282F8; Tue, 7 Aug 2012 18:58:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F238A282F8 for ; Tue, 7 Aug 2012 18:58:39 +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 6RqTOEQhVpLT for ; Tue, 7 Aug 2012 18:58:39 +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-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by theia.denx.de (Postfix) with ESMTPS id 13686282F7 for ; Tue, 7 Aug 2012 18:58:37 +0200 (CEST) Received: by pbbrr4 with SMTP id rr4so5977716pbb.3 for ; Tue, 07 Aug 2012 09:58:35 -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:mime-version :content-type:content-transfer-encoding; bh=ykEdLdaZw9TvYod4NktmoaknxbHKEQ1HLOIo7A34qQA=; b=igt1LhQiLiAizeQEaYoAh9Q32f+EP4VBiJnv2liNJii/kRtCa1ChE+sSr4mX15FtaO sr8jJv+TCe5aOGBSRzeys9Us0hVsZMiXSIyKtvgbJLzFfd0YTmNtKeDPttZWellURRnL qigfBcLVJ9rXqrZS/KOMBU32Lv7P4emc6OAQACfCR1aM74FebOr9LH/SyZ9urB/IMwAd 8pQ6KCkxNi9xIAYMURlJbuTYO+r1SgZADAkGxNPw/+gfOAYCwm6vAwRdY692FpHFUtn4 O14CqCzwNLxUtP+sIStBtK+Tq9lzk3WudUQhUjYb1kVaYgENYphYbo1LXUjFsO83OWcA j/Nw== Received: by 10.68.130.37 with SMTP id ob5mr28993598pbb.62.1344358715204; Tue, 07 Aug 2012 09:58:35 -0700 (PDT) Received: from localhost.localdomain (ip68-230-54-74.ph.ph.cox.net. [68.230.54.74]) by mx.google.com with ESMTPS id ng8sm11506226pbc.13.2012.08.07.09.58.33 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Aug 2012 09:58:34 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Tue, 7 Aug 2012 09:58:34 -0700 Message-Id: <1344358714-14032-1-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Cc: Reinhard Arlt , Kim Phillips Subject: [U-Boot] [PATCH] ext2fs: fix warning: 'blocknxt' may be used uninitialized with gcc 4.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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The above warning was introduced originally in 436da3c "ext2load: increase read speed" and fixed for newer toolchains in b803273 "ext2fs: fix warning: 'blocknxt' may be used uninitialized". This change did not fix the warning with gcc 4.2, as found in ELDK 4.2. If we rework the while loop to initalize blocknxt before entering the warning really goes away. Tested on am335x with an approx 7mb file and crc32 in U-Boot befor and after this change. Cc: Wolfgang Denk Cc: Eric Nelson Cc: Thierry Reding Cc: Jason Cooper Cc: Andreas Bießmann Cc: Reinhard Arlt Cc: Kim Phillips Signed-off-by: Tom Rini --- fs/ext2/ext2fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c index 182f0ac..418404e 100644 --- a/fs/ext2/ext2fs.c +++ b/fs/ext2/ext2fs.c @@ -440,9 +440,8 @@ int ext2fs_read_file /* grab middle blocks in one go */ if (i != pos / blocksize && i < blockcnt - 1 && blockcnt > 3) { int oldblk = blknr; - int blocknxt; + int blocknxt = ext2fs_read_block(node, i + 1); while (i < blockcnt - 1) { - blocknxt = ext2fs_read_block(node, i + 1); if (blocknxt == (oldblk + 1)) { oldblk = blocknxt; i++; @@ -450,6 +449,7 @@ int ext2fs_read_file blocknxt = ext2fs_read_block(node, i); break; } + blocknxt = ext2fs_read_block(node, i); } if (oldblk == blknr)