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>
* 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);
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) {
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);
free(opt);
efi_free_pool(volume_handles);
+ if (ret == EFI_NOT_FOUND)
+ return EFI_SUCCESS;
return ret;
}