]> 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 efc862e64b8b73f8f797c5ff42383e04ce84aa05..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
@@ -1043,7 +1042,7 @@ InitializeBM (
     IfrLibUpdateForm (\r
       BmmCallbackInfo->BmmHiiHandle,\r
       &mBootMaintGuid,\r
-      FORM_MAIN_ID,\r
+      FORM_BOOT_SETUP_ID,\r
       FORM_BOOT_LEGACY_DEVICE_ID,\r
       FALSE,\r
       &gUpdateData\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