From bbb212afa0f8e33e0b686a1b6ffd85d353eed83d Mon Sep 17 00:00:00 2001 From: Jeff Westfahl Date: Fri, 5 May 2017 05:53:03 +0800 Subject: ShellPkg/HandleParsingLib: Open LoadedImageProtocol first This patch changes the order of operations to make sure we can open the LoadedImageProtocol before getting the format string. This should not affect functionality, and makes the next patch easier to review. Cc: Ruiyu Ni Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl Reviewed-by: Ruiyu Ni Reviewed-by: Jaben Carsey --- .../Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'ShellPkg') diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index 2db8a3a2cf..c96f6dd157 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -177,13 +177,6 @@ LoadedImageProtocolDumpInformation( return (CatSPrint(NULL, L"LoadedImage")); } - HandleParsingHiiInit(); - - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_MAIN), NULL); - if (Temp == NULL) { - return NULL; - } - Status = gBS->OpenProtocol ( TheHandle, &gEfiLoadedImageProtocolGuid, @@ -194,7 +187,13 @@ LoadedImageProtocolDumpInformation( ); if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (Temp); + return NULL; + } + + HandleParsingHiiInit(); + + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_MAIN), NULL); + if (Temp == NULL) { return NULL; } -- cgit v1.2.3