summaryrefslogtreecommitdiff
path: root/tools/env/fw_env.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-06-03 11:44:12 -0400
committerTom Rini <trini@konsulko.com>2020-06-03 11:44:12 -0400
commit49c8c91cc69546f7a2017bc0943ef1225a01c72c (patch)
treef91b7127c7f7c9798f511e786d0b6a3116d79f53 /tools/env/fw_env.c
parentecd4d99f654f3f7bfb96001891d69c3125e70b69 (diff)
parent9f8aa0fbee40b66ceeaab06d3a0ce9a7a7d692a7 (diff)
Merge branch '2020-06-03-misc-bugfixes'
- Update various docs to not have 'ARCH=' in them as that's not part of how U-Boot builds. - Add macOS tools-only build to Azure to help catch problems on BSD hosts with tools. - Bugfixes from the latest header cleanup around ARCH_DMA_MINALIGN - Assorted small Kconfig logic/typo corrections - Add a default hash to FIT images that have their its auto generated. - Other assorted fixes
Diffstat (limited to 'tools/env/fw_env.c')
-rw-r--r--tools/env/fw_env.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 8734663cd4c..c6378ecf34f 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -946,11 +946,17 @@ static int flash_read_buf(int dev, int fd, void *buf, size_t count,
lseek(fd, blockstart + block_seek, SEEK_SET);
rc = read(fd, buf + processed, readlen);
- if (rc != readlen) {
+ if (rc == -1) {
fprintf(stderr, "Read error on %s: %s\n",
DEVNAME(dev), strerror(errno));
return -1;
}
+ if (rc != readlen) {
+ fprintf(stderr, "Read error on %s: "
+ "Attempted to read %d bytes but got %d\n",
+ DEVNAME(dev), readlen, rc);
+ return -1;
+ }
#ifdef DEBUG
fprintf(stderr, "Read 0x%x bytes at 0x%llx on %s\n",
rc, (unsigned long long)blockstart + block_seek,