summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2021-02-04 23:11:06 -0500
committerJagan Teki <jagan@amarulasolutions.com>2021-02-26 15:47:07 +0530
commit1bb8ca3b4b3debfa6b42f3430c81c00c3807cafe (patch)
treecd525af0147f9398958a86c7d426b3192c0a0360
parent90d76f812b29c88f47279eca034da70d30a798d9 (diff)
downloadu-boot-1bb8ca3b4b3debfa6b42f3430c81c00c3807cafe.tar.gz
cmd: sf: Display errno on erase failure
If there is an error while erasing SPI flash, no errno is displayed. This makes it difficult to determine the cause of the error. This change mirrors the logic for write errors above. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
-rw-r--r--cmd/sf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/sf.c b/cmd/sf.c
index c0d6a8f8a0..de80fcd38b 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -344,8 +344,11 @@ static int do_spi_flash_erase(int argc, char *const argv[])
}
ret = spi_flash_erase(flash, offset, size);
- printf("SF: %zu bytes @ %#x Erased: %s\n", (size_t)size, (u32)offset,
- ret ? "ERROR" : "OK");
+ printf("SF: %zu bytes @ %#x Erased: ", (size_t)size, (u32)offset);
+ if (ret)
+ printf("ERROR %d\n", ret);
+ else
+ printf("OK\n");
return ret == 0 ? 0 : 1;
}