]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/PlatformBootManagerLib: fix bug in ESRT invocation
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 6 Oct 2017 21:27:24 +0000 (22:27 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 6 Oct 2017 21:31:10 +0000 (22:31 +0100)
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 <ard.biesheuvel@linaro.org>
ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c

index e95069516216fba3fa24bfa7d16e0f976211f5b7..95e739c66c2931c63f295dc336c6bd32824d12b8 100644 (file)
@@ -458,17 +458,13 @@ PlatformBootManagerBeforeConsole (
     Status = ProcessCapsules ();\r
     DEBUG ((DEBUG_INFO, "ProcessCapsules returned %r\n", Status));\r
   } else {\r
-    if (EsrtManagement != NULL) {\r
+    Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL,\r
+                    (VOID **)&EsrtManagement);\r
+    if (!EFI_ERROR (Status)) {\r
       EsrtManagement->SyncEsrtFmp ();\r
     }\r
   }\r
 \r
-  Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL,\r
-                  (VOID **)&EsrtManagement);\r
-  if (EFI_ERROR (Status)) {\r
-    EsrtManagement = NULL;\r
-  }\r
-\r
   //\r
   // Signal EndOfDxe PI Event\r
   //\r