From: Sughosh Ganu Date: Tue, 30 Jul 2024 11:11:29 +0000 (+0530) Subject: efi_memory: use list_count_nodes() to count list entries X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/%7B%7B%20.RelPermalink%20%7D%7D?a=commitdiff_plain;h=22f893047db9560400415316256959ed29167d04;p=u-boot.git efi_memory: use list_count_nodes() to count list entries Use the API function list_count_nodes() to count the number of EFI memory map entries. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 12cf23fa3f..9a62864a00 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -742,8 +742,8 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, efi_uintn_t *descriptor_size, uint32_t *descriptor_version) { + size_t map_entries; efi_uintn_t map_size = 0; - int map_entries = 0; struct list_head *lhandle; efi_uintn_t provided_map_size; @@ -752,8 +752,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, provided_map_size = *memory_map_size; - list_for_each(lhandle, &efi_mem) - map_entries++; + map_entries = list_count_nodes(&efi_mem); map_size = map_entries * sizeof(struct efi_mem_desc);