Skip to contentSkip to conversation

cmd_sf.c: fix compilation warning

PATCH New Andreas Bießmann 2 participants 2 messages Oct 5, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd_sf.c: fix compilation warning

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.

---
 common/cmd_sf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_sf.c +1 -1
index c8c547a..d84dea0 100644
@@ -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) {
Signature · 1 line
1.7.6.3
#1 lore raw

PATCH 1/1 cmd_sf.c: fix compilation warning

Ouch,

Am 05.10.2011 09:23, schrieb Andreas Bie?mann:

Quoted 10 lines

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.

superseeded by several patches.

regards

Andreas Bie?mann