mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
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>
This commit is contained in:
parent
31a4f1e5b6
commit
8e8a4bc22f
1 changed files with 3 additions and 3 deletions
|
@ -161,12 +161,11 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,
|
||||||
char *cmp_buf;
|
char *cmp_buf;
|
||||||
const char *end = buf + len;
|
const char *end = buf + len;
|
||||||
size_t todo; /* number of bytes to do in this pass */
|
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);
|
cmp_buf = malloc(flash->sector_size);
|
||||||
if (cmp_buf) {
|
if (cmp_buf) {
|
||||||
for (skipped = 0; buf < end && !err_oper;
|
for (; buf < end && !err_oper; buf += todo, offset += todo) {
|
||||||
buf += todo, offset += todo) {
|
|
||||||
todo = min(end - buf, flash->sector_size);
|
todo = min(end - buf, flash->sector_size);
|
||||||
err_oper = spi_flash_update_block(flash, offset, todo,
|
err_oper = spi_flash_update_block(flash, offset, todo,
|
||||||
buf, cmp_buf, &skipped);
|
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,
|
printf("%zu bytes written, %zu bytes skipped\n", len - skipped,
|
||||||
skipped);
|
skipped);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue