efi_loader: use list_count_nodes() in efi_protocols_per_handle()

Simplify the code by using the list_count_nodes() function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Heinrich Schuchardt 2024-07-31 10:13:04 +02:00
parent 7bd2559cb3
commit 68bd345668

View File

@ -2509,16 +2509,12 @@ static efi_status_t EFIAPI efi_protocols_per_handle(
return EFI_EXIT(EFI_INVALID_PARAMETER);
*protocol_buffer = NULL;
*protocol_buffer_count = 0;
efiobj = efi_search_obj(handle);
if (!efiobj)
return EFI_EXIT(EFI_INVALID_PARAMETER);
/* Count protocols */
list_for_each(protocol_handle, &efiobj->protocols) {
++*protocol_buffer_count;
}
*protocol_buffer_count = list_count_nodes(&efiobj->protocols);
/* Copy GUIDs */
if (*protocol_buffer_count) {