Adding a size to the error message means that we can just use a single error message for either error case with no loss of information. While at it, we turn the error string into a code: This file can be built for PBL later on and we won't have efi_strerror there. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- efi/payload/early-mem.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/efi/payload/early-mem.c b/efi/payload/early-mem.c index 24bc1d34cc51..f9bf562c98ad 100644 --- a/efi/payload/early-mem.c +++ b/efi/payload/early-mem.c @@ -18,15 +18,12 @@ efi_physical_addr_t efi_earlymem_alloc(const struct efi_system_table *sys_table, efiret = bs->allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_LOADER_DATA, *memsize/PAGE_SIZE, &mem); - if (!EFI_ERROR(efiret)) + if (!EFI_ERROR(efiret) || efiret != EFI_OUT_OF_RESOURCES) break; - if (efiret != EFI_OUT_OF_RESOURCES) - panic("failed to allocate malloc pool: %s\n", - efi_strerror(efiret)); } if (EFI_ERROR(efiret)) - panic("failed to allocate malloc pool: %s\n", - efi_strerror(efiret)); + panic("failed to allocate %zu byte memory pool: 0x%lx\n", + *memsize, efiret); return mem; } -- 2.39.2