]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Fix incorrect return code of boot option update
authorRaymond Mao <raymond.mao@linaro.org>
Mon, 19 Jun 2023 21:22:59 +0000 (14:22 -0700)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 15 Jul 2023 09:20:41 +0000 (11:20 +0200)
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>
cmd/bootmenu.c
cmd/eficonfig.c
lib/efi_loader/efi_bootmgr.c

index 01daddca7b3ae8cfc0f6a3f5d19720bb088767e9..987b16889f83a6eeb997d51a4d5da9a56527363b 100644 (file)
@@ -352,7 +352,7 @@ static struct bootmenu_data *bootmenu_create(int delay)
                 * a architecture-specific default image name such as BOOTAA64.EFI.
                 */
                efi_ret = efi_bootmgr_update_media_device_boot_option();
-               if (efi_ret != EFI_SUCCESS && efi_ret != EFI_NOT_FOUND)
+               if (efi_ret != EFI_SUCCESS)
                        goto cleanup;
 
                ret = prepare_uefi_bootorder_entry(menu, &iter, &i);
index 82a80306f4fa7ed7c3506a7c311deba229c02fa3..e6e8a0a488e71f472e1b64ad7c00df0440eb2ef9 100644 (file)
@@ -2314,7 +2314,7 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
                return CMD_RET_FAILURE;
 
        ret = efi_bootmgr_update_media_device_boot_option();
-       if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND)
+       if (ret != EFI_SUCCESS)
                return ret;
 
        while (1) {
index f6110f22694cb65ad63444573791be06ef3a2333..993bb1139cd525e5c056685c6d86c47ac90d0241 100644 (file)
@@ -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;
 }