From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Andreas_Bie=DFmann?= Date: Wed, 04 Jul 2012 00:12:12 +0200 Subject: [U-Boot] [PATCH] ext2fs: fix warning: 'blocknxt' may be used uninitialized In-Reply-To: <20120703110542.c8b827398ebcedf3448725e1@freescale.com> References: <1332945431-12441-1-git-send-email-u-boot@lakedaemon.net> <1338566090-15008-1-git-send-email-u-boot@lakedaemon.net> <20120621204947.21CBE202253@gemini.denx.de> <20120703110542.c8b827398ebcedf3448725e1@freescale.com> Message-ID: <4FF36E3C.4000808@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Kim Philips, On 03.07.12 18:05, Kim Phillips wrote: > ext2fs.c: In function 'ext2fs_read_file': > ext2fs.c:458:19: warning: 'blocknxt' may be used uninitialized in this function [-Wuninitialized] > > Cc: Jason Cooper > Signed-off-by: Kim Phillips > --- > is this right? > > fs/ext2/ext2fs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c > index f1fce48..c6c950e 100644 > --- a/fs/ext2/ext2fs.c > +++ b/fs/ext2/ext2fs.c > @@ -440,7 +440,7 @@ 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 = 0; > while (i < blockcnt - 1) { > blocknxt = ext2fs_read_block(node, i + 1); > if (blocknxt == (oldblk + 1)) { > there are two other solutions. I dunno which should we use but Thierry Reding suggested another working one which I think its cleaner. Please read http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/134043 Best regards Andreas Bie?mann