mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-15 22:41:38 +00:00
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user