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

login
register
mail settings
Submitter Andreas Bießmann
Date Oct. 5, 2011, 7:23 a.m.
Message ID <1317799406-14698-1-git-send-email-biessmann@corscience.de>
Download mbox | patch
Permalink /patch/117754/
State Superseded
Headers show

Comments

Andreas Bießmann - Oct. 5, 2011, 7:23 a.m.
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@corscience.de>
---
 common/cmd_sf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Andreas Bießmann - Oct. 5, 2011, 8:54 a.m.
Ouch,

Am 05.10.2011 09:23, schrieb Andreas Bießmann:
> 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

Patch

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) {