]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: use list_count_nodes() in efi_protocols_per_handle()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 31 Jul 2024 08:13:04 +0000 (10:13 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 11 Aug 2024 05:47:23 +0000 (07:47 +0200)
Simplify the code by using the list_count_nodes() function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_boottime.c

index eedc5f3954922e699626c8979fb9dfe13fefec85..4f52284b4c653c252b0ed6c0c87da8901448d4b4 100644 (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) {