summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-04 20:00:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-05 16:28:06 +0100
commitcc43c6e4c6cd3810c21f936428569dffa63b9dbb (patch)
treeb621587f7b15e3bef53ec1adfface15f83e19626
parentc6d2ed6850eeba71f3913904ccb6a45442177a06 (diff)
downloadbarebox-cc43c6e4c6cd.tar.gz
barebox-cc43c6e4c6cd.tar.xz
efi: payload: early-mem: simplify error message reporting
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@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-85-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--efi/payload/early-mem.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/efi/payload/early-mem.c b/efi/payload/early-mem.c
index 24bc1d34cc..f9bf562c98 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;
}