diff options
| author | Ada Christine <adachristine18@gmail.com> | 2021-03-18 01:27:06 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2021-03-18 01:27:06 +0000 |
| commit | 0858b3983ff2e8b90a158741955b30f9f2fb374f (patch) | |
| tree | 0792262f83c623829557d758458a6dc0b0e8921e | |
| parent | 7a9b1a969d8538e129c6b0c413ad0513e51f5ece (diff) | |
using efi_allocate() where i'm supposed to
| -rw-r--r-- | loader/loader_efi.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/loader/loader_efi.c b/loader/loader_efi.c index 05b15c2..b56ebb9 100644 --- a/loader/loader_efi.c +++ b/loader/loader_efi.c @@ -292,12 +292,10 @@ static struct efi_memory_map_data *get_memory_map_data(void) if (status == EFI_BUFFER_TOO_SMALL) { - status = e_bs->AllocatePool(EfiLoaderData, - mapsize + sizeof(*map), - (VOID **)&map); + map = efi_allocate(sizeof(*map)); } - if (!EFI_ERROR(status)) + if (map) { status = e_bs->GetMemoryMap(&map->size, map->data, @@ -305,6 +303,10 @@ static struct efi_memory_map_data *get_memory_map_data(void) &map->descsize, &map->descver); } + else + { + status = e_last_error; + } if (EFI_ERROR(status)) { @@ -317,7 +319,6 @@ static struct efi_memory_map_data *get_memory_map_data(void) static struct efi_framebuffer_data *get_framebuffer_data(void) { - EFI_STATUS status; struct efi_framebuffer_data *framebuffer; if (!e_graphics_output) @@ -325,11 +326,9 @@ static struct efi_framebuffer_data *get_framebuffer_data(void) return NULL; } - status = e_bs->AllocatePool(EfiLoaderData, - sizeof *framebuffer, - (VOID **)&framebuffer); + framebuffer = efi_allocate(sizeof(*framebuffer)); - if (!EFI_ERROR(status)) + if (framebuffer) { EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *mode = e_graphics_output->Mode; @@ -354,10 +353,9 @@ static struct efi_framebuffer_data *get_framebuffer_data(void) framebuffer->pitch = framebuffer->width * framebuffer->pixel_size; } - else { - Print(L"failed getting framebuffer data: %r\r\n", status); + Print(L"failed getting framebuffer data: %r\r\n", e_last_error); return NULL; } |
