]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
Fix the bug that Boot Mainteinance Manager in the front page can not be entered twice...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMaint / BootMaint.c
index f5e0bf04a026a6d8ebd578f88f4c369a2b4510ba..98aadd6ce187cd1f3ebe407089381c084c866c04 100644 (file)
@@ -910,7 +910,7 @@ InitializeBM (
                   NULL\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    return Status;\r
+    goto Exit;\r
   }\r
 \r
   //\r
@@ -925,7 +925,7 @@ InitializeBM (
                   NULL\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    return Status;\r
+    goto Exit;\r
   }\r
 \r
   //\r
@@ -962,9 +962,8 @@ InitializeBM (
   gUpdateData.BufferSize = UPDATE_DATA_SIZE;\r
   gUpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
   if (gUpdateData.Data == NULL) {\r
-    FreePool (BmmCallbackInfo->LoadContext);\r
-    FreePool (BmmCallbackInfo);\r
-    return EFI_OUT_OF_RESOURCES;\r
+    Status = EFI_OUT_OF_RESOURCES;\r
+    goto Exit;\r
   }\r
 \r
   InitializeStringDepository ();\r
@@ -1065,11 +1064,35 @@ InitializeBM (
 \r
   FreeAllMenu ();\r
 \r
-  FreePool (BmmCallbackInfo->LoadContext);\r
-  FreePool (BmmCallbackInfo);\r
   FreePool (gUpdateData.Data);\r
   gUpdateData.Data = NULL;\r
 \r
+Exit:\r
+  if (BmmCallbackInfo->FeDriverHandle != NULL) {\r
+    gBS->UninstallMultipleProtocolInterfaces (\r
+           BmmCallbackInfo->FeDriverHandle,\r
+           &gEfiDevicePathProtocolGuid,\r
+           &mFeHiiVendorDevicePath,\r
+           &gEfiHiiConfigAccessProtocolGuid,\r
+           &BmmCallbackInfo->FeConfigAccess,\r
+           NULL\r
+           );\r
+  }\r
+\r
+  if (BmmCallbackInfo->BmmDriverHandle != NULL) {\r
+    gBS->UninstallMultipleProtocolInterfaces (\r
+           BmmCallbackInfo->BmmDriverHandle,\r
+           &gEfiDevicePathProtocolGuid,\r
+           &mBmmHiiVendorDevicePath,\r
+           &gEfiHiiConfigAccessProtocolGuid,\r
+           &BmmCallbackInfo->BmmConfigAccess,\r
+           NULL\r
+           );\r
+  }\r
+\r
+  FreePool (BmmCallbackInfo->LoadContext);\r
+  FreePool (BmmCallbackInfo);\r
+\r
   return Status;\r
 }\r
 \r