diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2024-12-19 15:30:39 +0100 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2025-01-14 08:35:27 +0100 |
commit | ad69b0b6f9954796875ee4faf6c16c9caca21999 (patch) | |
tree | 76b025f3e4e516e8cd6ce3fd2702ac7728a76363 /drivers/firmware/efi/libstub/randomalloc.c | |
parent | 90534e689d2e52202c276ade5cf1dfc13d9e116f (diff) |
efi/libstub: Use cleanup helpers for freeing copies of the memory map
The EFI stub may obtain the memory map from the firmware numerous times,
and this involves doing a EFI pool allocation first, which needs to be
freed after use.
Streamline this using a cleanup helper, which makes the code easier to
follow.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/randomalloc.c')
-rw-r--r-- | drivers/firmware/efi/libstub/randomalloc.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/firmware/efi/libstub/randomalloc.c b/drivers/firmware/efi/libstub/randomalloc.c index c41e7b2091cd..e5872e38d9a4 100644 --- a/drivers/firmware/efi/libstub/randomalloc.c +++ b/drivers/firmware/efi/libstub/randomalloc.c @@ -59,9 +59,9 @@ efi_status_t efi_random_alloc(unsigned long size, unsigned long alloc_min, unsigned long alloc_max) { + struct efi_boot_memmap *map __free(efi_pool) = NULL; unsigned long total_slots = 0, target_slot; unsigned long total_mirrored_slots = 0; - struct efi_boot_memmap *map; efi_status_t status; int map_offset; @@ -130,7 +130,5 @@ efi_status_t efi_random_alloc(unsigned long size, break; } - efi_bs_call(free_pool, map); - return status; } |