From aed68ed6bec5432d531e68e825400907c4968cc3 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 6 Oct 2017 22:27:24 +0100 Subject: [PATCH] ArmPkg/PlatformBootManagerLib: fix bug in ESRT invocation The ESRT hook call that I just added invokes the protocol before retrieving a pointer to it, which interestingly enough did not result in any crashes, nor did it get picked up by GCC. Clang did notice, though, so let's fix it right away. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c index e950695162..95e739c66c 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -458,17 +458,13 @@ PlatformBootManagerBeforeConsole ( Status = ProcessCapsules (); DEBUG ((DEBUG_INFO, "ProcessCapsules returned %r\n", Status)); } else { - if (EsrtManagement != NULL) { + Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL, + (VOID **)&EsrtManagement); + if (!EFI_ERROR (Status)) { EsrtManagement->SyncEsrtFmp (); } } - Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL, - (VOID **)&EsrtManagement); - if (EFI_ERROR (Status)) { - EsrtManagement = NULL; - } - // // Signal EndOfDxe PI Event // -- 2.39.2