[PATCH] 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 ---
boot/bootmeth-uclass.c | 2 +- boot/bootmeth_efi.c | 2 +- cmd/bootflow.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c index 2aee1e0f0c56..3b3e0614dafa 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 6f70f2229b9b..af31fbfc85db 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);
diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 6cc58e48c7d0..5c61286a2a76 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -55,7 +55,7 @@ static void report_bootflow_err(struct bootflow *bflow, int err) break; }
- printf(", err=%d\n", err); + printf(", err=%dE\n", err); }
/**
participants (1)
-
Simon Glass