[U-Boot] [PATCH] cmd_sf.c: fix compilation warning

Andreas Bießmann biessmann at corscience.de
Wed Oct 5 09:23:26 CEST 2011


building ./MAKEALL avr32 complains about

---8<---
Configuring for atngw100 board...
cmd_sf.c: In function 'do_spi_flash':
cmd_sf.c:164: warning: 'skipped' may be used uninitialized in this function
cmd_sf.c:164: note: 'skipped' was declared here
--->8---

This patch fixes it by defining skipped to maximum value.

Signed-off-by: Andreas Bießmann <biessmann at corscience.de>
---
 common/cmd_sf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index c8c547a..d84dea0 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -161,7 +161,7 @@ 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 = len;		/* statistics */
 
 	cmp_buf = malloc(flash->sector_size);
 	if (cmp_buf) {
-- 
1.7.6.3



More information about the U-Boot mailing list