]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine error handle code, avoid assert when load this module twice.
authorEric Dong <eric.dong@intel.com>
Fri, 8 Jan 2016 05:21:55 +0000 (05:21 +0000)
committerydong10 <ydong10@Edk2>
Fri, 8 Jan 2016 05:21:55 +0000 (05:21 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19625 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf

index bcf3ec97f6d05828df8c33ca225f4d90a39b0847..9714dbcf5d24d52bc77a54d1999690052f57a7bd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 File explorer related functions.\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under\r
 the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
@@ -1442,7 +1442,12 @@ FileExplorerLibConstructor (
                   &gFileExplorerPrivate.FeConfigAccess,\r
                   NULL\r
                   );\r
-  ASSERT_EFI_ERROR (Status);\r
+  if (Status == EFI_ALREADY_STARTED) {\r
+    return EFI_SUCCESS;\r
+  }\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   //\r
   // Post our File Explorer VFR binary to the HII database.\r
@@ -1486,17 +1491,19 @@ FileExplorerLibDestructor (
 \r
   ASSERT (gHiiVendorDevicePath != NULL);\r
 \r
-  Status = gBS->UninstallMultipleProtocolInterfaces (\r
-                  gFileExplorerPrivate.FeDriverHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  gHiiVendorDevicePath,\r
-                  &gEfiHiiConfigAccessProtocolGuid,\r
-                  &gFileExplorerPrivate.FeConfigAccess,\r
-                  NULL\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-  \r
-  HiiRemovePackages (gFileExplorerPrivate.FeHiiHandle);\r
+  if (gFileExplorerPrivate.FeDriverHandle != NULL) {\r
+    Status = gBS->UninstallMultipleProtocolInterfaces (\r
+                    gFileExplorerPrivate.FeDriverHandle,\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    gHiiVendorDevicePath,\r
+                    &gEfiHiiConfigAccessProtocolGuid,\r
+                    &gFileExplorerPrivate.FeConfigAccess,\r
+                    NULL\r
+                    );\r
+    ASSERT_EFI_ERROR (Status);\r
+    \r
+    HiiRemovePackages (gFileExplorerPrivate.FeHiiHandle);\r
+  }\r
 \r
   FreePool (gHiiVendorDevicePath);\r
 \r
index 2770ca98a5f5006188baba7d3b1ca94bf97211c8..a97fd4a83b5d0e9ddb38bfd40a256b7bcaa064d5 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  library defines a set of interfaces for how to do file explorer.\r
 #  \r
-#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials are licensed and made available under\r
 #  the terms and conditions of the BSD License that accompanies this distribution.\r
 #  The full text of the license may be found at\r
@@ -57,4 +57,7 @@
   gEfiLoadFileProtocolGuid                      ## CONSUMES\r
   gEfiHiiConfigAccessProtocolGuid               ## CONSUMES\r
   gEfiFormBrowser2ProtocolGuid                  ## CONSUMES\r
-  gEfiDevicePathToTextProtocolGuid              ## CONSUMES
\ No newline at end of file
+  gEfiDevicePathToTextProtocolGuid              ## CONSUMES\r
+\r
+[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]\r
+  gEfiFormBrowser2ProtocolGuid AND gEfiHiiDatabaseProtocolGuid
\ No newline at end of file