diff options
author | Steffen Trumtrar <s.trumtrar@pengutronix.de> | 2020-05-04 10:35:42 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-05-05 07:55:52 +0200 |
commit | 64811812811963fd5ab079ab2e23e59e14c3b359 (patch) | |
tree | 6feea122f6d70c0a0c7acdafdc3d5c53c6462544 /common/imd.c | |
parent | 8a92fae86eb261ee9349a5d148d5c9d865c91177 (diff) | |
download | barebox-64811812811963fd5ab079ab2e23e59e14c3b359.tar.gz barebox-64811812811963fd5ab079ab2e23e59e14c3b359.tar.xz |
common: imd: handle error in imd_write_crc32
Don't just ignore the return value of write_file.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/imd.c')
-rw-r--r-- | common/imd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/imd.c b/common/imd.c index 62be30040e..96496514a5 100644 --- a/common/imd.c +++ b/common/imd.c @@ -367,6 +367,7 @@ static int imd_write_crc32(void *buf, const struct imd_header *imd_start, return -ENODATA; } else { uint32_t *p = (uint32_t *)(imd_crc + 1); + int ret; if (*p != crc) { uint32_t *flags = imd_crc32_flags(imd_crc); @@ -374,7 +375,11 @@ static int imd_write_crc32(void *buf, const struct imd_header *imd_start, debug("Update crc token from 0x%08x to 0x%08x (flags 0x%08x)\n", *p, crc, *flags); *p = crc; - write_file(filename, buf, size); + ret = write_file(filename, buf, size); + if (ret < 0) { + eprintf("CRC: write crc token to %s failed: %d\n", filename, ret); + return ret; + } } } |