aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRaymond Mao <raymond.mao@linaro.org>2023-06-19 14:22:59 -0700
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-07-15 11:20:41 +0200
commit9945bc4f867a9d0dd2c69b86b182265320f37d4b (patch)
tree71b727e892846f796ee5b667ff18956ea956e80c /lib
parent339b527bd4507404a2128ddad24ba060eba342c9 (diff)
downloadu-boot-9945bc4f867a9d0dd2c69b86b182265320f37d4b.zip
u-boot-9945bc4f867a9d0dd2c69b86b182265320f37d4b.tar.gz
u-boot-9945bc4f867a9d0dd2c69b86b182265320f37d4b.tar.bz2
Fix incorrect return code of boot option update
Correct the return code for out-of-memory and no boot option found Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_bootmgr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index f6110f2..993bb11 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -660,11 +660,13 @@ efi_status_t efi_bootmgr_update_media_device_boot_option(void)
NULL, &count,
(efi_handle_t **)&volume_handles);
if (ret != EFI_SUCCESS)
- return ret;
+ goto out;
opt = calloc(count, sizeof(struct eficonfig_media_boot_option));
- if (!opt)
+ if (!opt) {
+ ret = EFI_OUT_OF_RESOURCES;
goto out;
+ }
/* enumerate all devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL */
ret = efi_bootmgr_enumerate_boot_option(opt, volume_handles, count);
@@ -717,5 +719,7 @@ out:
free(opt);
efi_free_pool(volume_handles);
+ if (ret == EFI_NOT_FOUND)
+ return EFI_SUCCESS;
return ret;
}