Simplify the code by using the list_count_nodes() function.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
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) {