diff options
author | Patrick Georgi <pgeorgi@google.com> | 2017-10-05 15:44:24 +0200 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-14 08:03:05 -0700 |
commit | 828da3d55668edfc9b7d64e1d21dd0438fccfcd5 (patch) | |
tree | 771c6050a2220159b8831f8cfef9788f688ee14d /util | |
parent | 57ae0b0f18b7bb0360436143374065f17d675282 (diff) | |
download | chrome-ec-828da3d55668edfc9b7d64e1d21dd0438fccfcd5.tar.gz |
util/iteflash.c: make sure that the file is closed
An insignificant bug, but Coverity complains about it. Reduce the
cognitive load by making sure that file is closed in time.
BUG=none
BRANCH=none
TEST=none
Change-Id: I2efbe136f4991cf829b95568eef22eb7b2d1a8c6
Found-by: Coverity Scan #141758
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/702304
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/iteflash.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/iteflash.c b/util/iteflash.c index 3011600f3f..701c9dd2a5 100644 --- a/util/iteflash.c +++ b/util/iteflash.c @@ -916,12 +916,12 @@ int verify_flash(struct ftdi_context *ftdi, const char *filename, } file_size = fread(buffer, 1, flash_size, hnd); + fclose(hnd); if (file_size <= 0) { fprintf(stderr, "Cannot read %s\n", filename); res = -EIO; goto exit; } - fclose(hnd); printf("Verify %d bytes at 0x%08x\n", file_size, offset); res = command_read_pages(ftdi, offset, flash_size, buffer2); |