summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2012-08-07 09:58:34 -0700
committerWolfgang Denk <wd@denx.de>2012-08-07 20:52:42 +0200
commit94c1a20fe78c0d3ba44ee8674b91163dddad0d80 (patch)
treed110db075f8ab89403f7c7b06ec74e91a91b764c /fs/ext2
parent56249fea3d5e32cddcd9160e51ec93a9c4327c6b (diff)
downloadblackbird-obmc-uboot-94c1a20fe78c0d3ba44ee8674b91163dddad0d80.tar.gz
blackbird-obmc-uboot-94c1a20fe78c0d3ba44ee8674b91163dddad0d80.zip
ext2fs: fix warning: 'blocknxt' may be used uninitialized with gcc 4.2
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 <wd@denx.de> Cc: Eric Nelson <eric.nelson@boundarydevices.com> Cc: Thierry Reding <thierry.reding@avionic-design.de> Cc: Jason Cooper <u-boot@lakedaemon.net> Cc: Andreas Bießmann <andreas.devel@googlemail.com> Cc: Reinhard Arlt <reinhard.arlt@esd-electronics.com> Cc: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/ext2fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c
index 182f0acaca..418404e606 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)
OpenPOWER on IntegriCloud