summaryrefslogtreecommitdiff
path: root/common/cmd_sf.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2011-10-03 04:35:47 +0000
committerWolfgang Denk <wd@denx.de>2011-10-05 22:22:17 +0200
commit8e8a4bc22fc475244dd7c794f2271dd55399e859 (patch)
tree61aff0a7af305d9ac876928773cd24982bbd67ce /common/cmd_sf.c
parent31a4f1e5b6ee9b6335f0313dce7637cef887f84f (diff)
downloadu-boot-imx-8e8a4bc22fc475244dd7c794f2271dd55399e859.zip
u-boot-imx-8e8a4bc22fc475244dd7c794f2271dd55399e859.tar.gz
u-boot-imx-8e8a4bc22fc475244dd7c794f2271dd55399e859.tar.bz2
cmd_sf: Fix compiler warning
cmd_sf.c: In function 'do_spi_flash': cmd_sf.c:164:9: warning: 'skipped' may be used uninitialized in this function Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/cmd_sf.c')
-rw-r--r--common/cmd_sf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index c8c547a..7225656 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -161,12 +161,11 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,
char *cmp_buf;
const char *end = buf + len;
size_t todo; /* number of bytes to do in this pass */
- size_t skipped; /* statistics */
+ size_t skipped = 0; /* statistics */
cmp_buf = malloc(flash->sector_size);
if (cmp_buf) {
- for (skipped = 0; buf < end && !err_oper;
- buf += todo, offset += todo) {
+ for (; buf < end && !err_oper; buf += todo, offset += todo) {
todo = min(end - buf, flash->sector_size);
err_oper = spi_flash_update_block(flash, offset, todo,
buf, cmp_buf, &skipped);
@@ -181,6 +180,7 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,
}
printf("%zu bytes written, %zu bytes skipped\n", len - skipped,
skipped);
+
return 0;
}