mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
efi_selftest: LocateHandleBuffer return code
Check that LocateHandleBuffer() return EFI_NOT_FOUND when called with ByRegisterNotify and all handles already have been retrieved. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
1becdfcdc1
commit
75ebeb4d94
1 changed files with 11 additions and 5 deletions
|
@ -24,6 +24,7 @@ struct context {
|
||||||
efi_uintn_t notify_count;
|
efi_uintn_t notify_count;
|
||||||
efi_uintn_t handle_count;
|
efi_uintn_t handle_count;
|
||||||
efi_handle_t *handles;
|
efi_handle_t *handles;
|
||||||
|
efi_status_t ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct efi_boot_services *boottime;
|
static struct efi_boot_services *boottime;
|
||||||
|
@ -46,17 +47,18 @@ static struct efi_event *event;
|
||||||
static void EFIAPI notify(struct efi_event *event, void *context)
|
static void EFIAPI notify(struct efi_event *event, void *context)
|
||||||
{
|
{
|
||||||
struct context *cp = context;
|
struct context *cp = context;
|
||||||
efi_status_t ret;
|
|
||||||
efi_uintn_t handle_count;
|
efi_uintn_t handle_count;
|
||||||
efi_handle_t *handles;
|
efi_handle_t *handles;
|
||||||
|
|
||||||
cp->notify_count++;
|
cp->notify_count++;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY, NULL,
|
cp->ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY,
|
||||||
cp->registration_key,
|
NULL,
|
||||||
&handle_count, &handles);
|
cp->registration_key,
|
||||||
if (ret != EFI_SUCCESS)
|
&handle_count,
|
||||||
|
&handles);
|
||||||
|
if (cp->ret != EFI_SUCCESS)
|
||||||
break;
|
break;
|
||||||
cp->handle_count += handle_count;
|
cp->handle_count += handle_count;
|
||||||
cp->handles = handles;
|
cp->handles = handles;
|
||||||
|
@ -204,6 +206,10 @@ static int execute(void)
|
||||||
efi_st_error("LocateHandle failed\n");
|
efi_st_error("LocateHandle failed\n");
|
||||||
return EFI_ST_FAILURE;
|
return EFI_ST_FAILURE;
|
||||||
}
|
}
|
||||||
|
if (context.ret != EFI_NOT_FOUND) {
|
||||||
|
efi_st_error("LocateHandle did not return EFI_NOT_FOUND\n");
|
||||||
|
return EFI_ST_FAILURE;
|
||||||
|
}
|
||||||
ret = boottime->free_pool(context.handles);
|
ret = boottime->free_pool(context.handles);
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
efi_st_error("FreePool failed\n");
|
efi_st_error("FreePool failed\n");
|
||||||
|
|
Loading…
Reference in a new issue