summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 75bd5dcfb0..8a3a4027ee 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -991,9 +991,13 @@ BmExpandMediaDevicePath (
return FileBuffer;
}
+ Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);
+ ASSERT_EFI_ERROR (Status);
+
//
- // For device boot option only pointing to the removable device handle,
- // should make sure all its children handles (its child partion or media handles) are created and connected.
+ // For device boot option only pointing to the removable device handle,
+ // should make sure all its children handles (its child partion or media handles)
+ // are created and connected.
//
gBS->ConnectController (Handle, NULL, NULL, TRUE);
@@ -1004,8 +1008,6 @@ BmExpandMediaDevicePath (
// returned. After the Block IO protocol is reinstalled, subsequent
// Block IO read/write will success.
//
- Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);
- ASSERT_EFI_ERROR (Status);
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);
ASSERT_EFI_ERROR (Status);
Buffer = AllocatePool (BlockIo->Media->BlockSize);