util/iteflash: Return error on all verify failures

BUG=None
TEST=`make buildall -j`
BRANCH=None

Change-Id: Iefc8e1eaf1e5d7c8533d8497c227c8c16eb2c06d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/331200
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2016-03-07 10:02:46 -08:00
committed by chrome-bot
parent 866e849957
commit 554ecc6b9d

View File

@@ -885,7 +885,7 @@ int write_flash(struct ftdi_context *ftdi, const char *filename,
int verify_flash(struct ftdi_context *ftdi, const char *filename,
uint32_t offset)
{
int res = 0;
int res;
int file_size;
FILE *hnd;
uint8_t *buffer = malloc(flash_size);
@@ -906,6 +906,7 @@ int verify_flash(struct ftdi_context *ftdi, const char *filename,
file_size = fread(buffer, 1, flash_size, hnd);
if (file_size <= 0) {
fprintf(stderr, "Cannot read %s\n", filename);
res = -EIO;
goto exit;
}
fclose(hnd);