From 20fe1625567d0bc502a63818e3f416613bab813c Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Fri, 8 Jan 2016 05:21:55 +0000 Subject: Refine error handle code, avoid assert when load this module twice. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19625 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/FileExplorerLib/FileExplorer.c | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'MdeModulePkg/Library/FileExplorerLib/FileExplorer.c') diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c index bcf3ec97f6..9714dbcf5d 100644 --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c @@ -1,7 +1,7 @@ /** @file File explorer related functions. -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at @@ -1442,7 +1442,12 @@ FileExplorerLibConstructor ( &gFileExplorerPrivate.FeConfigAccess, NULL ); - ASSERT_EFI_ERROR (Status); + if (Status == EFI_ALREADY_STARTED) { + return EFI_SUCCESS; + } + if (EFI_ERROR (Status)) { + return Status; + } // // Post our File Explorer VFR binary to the HII database. @@ -1486,17 +1491,19 @@ FileExplorerLibDestructor ( ASSERT (gHiiVendorDevicePath != NULL); - Status = gBS->UninstallMultipleProtocolInterfaces ( - gFileExplorerPrivate.FeDriverHandle, - &gEfiDevicePathProtocolGuid, - gHiiVendorDevicePath, - &gEfiHiiConfigAccessProtocolGuid, - &gFileExplorerPrivate.FeConfigAccess, - NULL - ); - ASSERT_EFI_ERROR (Status); - - HiiRemovePackages (gFileExplorerPrivate.FeHiiHandle); + if (gFileExplorerPrivate.FeDriverHandle != NULL) { + Status = gBS->UninstallMultipleProtocolInterfaces ( + gFileExplorerPrivate.FeDriverHandle, + &gEfiDevicePathProtocolGuid, + gHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &gFileExplorerPrivate.FeConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + HiiRemovePackages (gFileExplorerPrivate.FeHiiHandle); + } FreePool (gHiiVendorDevicePath); -- cgit v1.2.3