[PATCH v2 009/113] efi: payload: image: return actual read_file() error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



read_file returns NULL on error and sets errno, e.g. to ENOMEM if the
image to be booted exceeds memory available to barebox. Yet, errno was
ignored and EINVAL was returned as error code unconditionally. Fix this
to improve user experience.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 efi/payload/image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efi/payload/image.c b/efi/payload/image.c
index 8e39098ae81b..8d29bf9bb434 100644
--- a/efi/payload/image.c
+++ b/efi/payload/image.c
@@ -86,7 +86,7 @@ static int efi_load_image(const char *file, efi_loaded_image_t **loaded_image,
 
 	exe = read_file(file, &size);
 	if (!exe)
-		return -EINVAL;
+		return -errno;
 
 	efiret = BS->load_image(false, efi_parent_image, efi_device_path, exe, size,
 			&handle);
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux