diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2017-10-26 19:25:55 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2017-12-01 13:22:56 +0100 |
commit | 42cf12420b0e5664fa118f3d19e153f48740664b (patch) | |
tree | 0e4de475678582eae395e61671a3baa7dea7afa7 | |
parent | 1202530d221936604e847fd7ce4bf8d8039d589b (diff) | |
download | u-boot-42cf12420b0e5664fa118f3d19e153f48740664b.tar.gz u-boot-42cf12420b0e5664fa118f3d19e153f48740664b.tar.xz u-boot-42cf12420b0e5664fa118f3d19e153f48740664b.zip |
efi_loader: simplify efi_search
Use helper function efi_search_protocol in efi_search.
Add missing comments.
Put default handling into default branch of switch statement.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | lib/efi_loader/efi_boottime.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 900cb1aad8..ff1f23356e 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -983,24 +983,21 @@ static int efi_search(enum efi_locate_search_type search_type, const efi_guid_t *protocol, void *search_key, struct efi_object *efiobj) { - int i; + efi_status_t ret; switch (search_type) { case ALL_HANDLES: return 0; case BY_REGISTER_NOTIFY: - /* RegisterProtocolNotify is not implemented yet */ + /* TODO: RegisterProtocolNotify is not implemented yet */ return -1; case BY_PROTOCOL: - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) { - const efi_guid_t *guid = efiobj->protocols[i].guid; - if (guid && !guidcmp(guid, protocol)) - return 0; - } + ret = efi_search_protocol(efiobj->handle, protocol, NULL); + return (ret != EFI_SUCCESS); + default: + /* Invalid search type */ return -1; } - - return -1; } /* |