summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-05-11 01:34:26 +0300
committerTom Rini <trini@konsulko.com>2023-05-13 16:52:32 +0300
commitc8894348454aef103a29e5afbfe45c0959b9d45b (patch)
treead0e08049b5acf510ab6f56fe9d30cd1188c47e2 /boot
parentd8d40bc392d1ce60660e479a73970666e6a8a7be (diff)
downloadu-boot-c8894348454aef103a29e5afbfe45c0959b9d45b.tar.xz
bootstd: Tidy up reporting of errors
In a few cases the error handling is not quite right. Make sure we return the actual error in distro_efi_read_bootflow_file() rather than -EINVAL. Return -IO when a file cannot be read. Also show the error name if available. This does not change operation, but does make it easier to diagnose problems. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot')
-rw-r--r--boot/bootmeth-uclass.c2
-rw-r--r--boot/bootmeth_efi.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c
index 2aee1e0f0c..3b3e0614da 100644
--- a/boot/bootmeth-uclass.c
+++ b/boot/bootmeth-uclass.c
@@ -319,7 +319,7 @@ static int alloc_file(const char *fname, uint size, void **bufp)
return log_msg_ret("read", ret);
}
if (size != bytes_read)
- return log_msg_ret("bread", -EINVAL);
+ return log_msg_ret("bread", -EIO);
buf[size] = '\0';
*bufp = buf;
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index 6f70f2229b..af31fbfc85 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -235,7 +235,7 @@ static int distro_efi_read_bootflow_file(struct udevice *dev,
ret = efiload_read_file(desc, bflow);
if (ret)
- return log_msg_ret("read", -EINVAL);
+ return log_msg_ret("read", ret);
fdt_addr = env_get_hex("fdt_addr_r", 0);