From: Thierry Reding Date: Wed, 27 Jun 2012 13:55:39 +0200 Subject: [U-Boot] [PATCH] fs/ext2/ext2fs.c: fix warning In-Reply-To: <1340797671-22171-1-git-send-email-andreas.devel@googlemail.com> References: <1340797671-22171-1-git-send-email-andreas.devel@googlemail.com> Message-ID: <20120627115539.GA4301@avionic-0098.mockup.avionic-design.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Jun 27, 2012 at 01:47:51PM +0200, Andreas Bie?mann wrote: > This patch fixes following warning: > ---8<--- > ext2fs.c: In function 'ext2fs_read_file': > ext2fs.c:458:19: warning: 'blocknxt' may be used uninitialized in this function [-Wuninitialized] > --->8--- > > The warning was introduced in 436da3cd233e7166b5ce9293dbd28092cf37bcc9. > > Signed-off-by: Andreas Bie?mann > cc: Jason Cooper > cc: Eric Nelson > cc: Thierry Reding > --- > 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..40b6e6f 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 = blknr; > while (i < blockcnt - 1) { > blocknxt = ext2fs_read_block(node, i + 1); > if (blocknxt == (oldblk + 1)) { This doesn't look quite right. The warning should go away as well if you change the "i != blockcnt - 1" to "i < blockcnt - 1" in the condition above. I think that'd be more appropriate, but perhaps Jason is better qualified to comment. Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: