OcAppleDiskImageLib: Remove BLock I/O Handle duplicate.
@@ -81,7 +81,6 @@ typedef PACKED struct {
typedef struct {
UINT32 Signature;
- EFI_HANDLE Handle;
EFI_BLOCK_IO_PROTOCOL BlockIo;
EFI_BLOCK_IO_MEDIA BlockIoMedia;
DMG_DEVICE_PATH DevicePath;
@@ -273,7 +272,6 @@ OcAppleDiskImageInstallBlockIo (
}
DiskImageData->Signature = OC_APPLE_DISK_IMAGE_MOUNTED_DATA_SIGNATURE;
- DiskImageData->Handle = NULL;
DiskImageData->ImageContext = Context;
DiskImageData->RamDmgHeader = RamDmgHeader;
CopyMem (
@@ -291,7 +289,7 @@ OcAppleDiskImageInstallBlockIo (
InternalConstructDmgDevicePath (DiskImageData, RamDmgAddress);
Status = gBS->InstallMultipleProtocolInterfaces (
- &DiskImageData->Handle,
+ &Context->BlockIoHandle,
&gEfiBlockIoProtocolGuid,
&DiskImageData->BlockIo,
&gEfiDevicePathProtocolGuid,
@@ -299,28 +297,28 @@ OcAppleDiskImageInstallBlockIo (
NULL
);
if (EFI_ERROR(Status)) {
+ Context->BlockIoHandle = NULL;
FreePool (DiskImageData);
gBS->FreePages (RamDmgAddress, NumRamDmgPages);
return FALSE;
}
- Status = gBS->ConnectController (DiskImageData->Handle, NULL, NULL, TRUE);
+ Status = gBS->ConnectController (Context->BlockIoHandle, NULL, NULL, TRUE);
if (EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
- DiskImageData->Handle,
+ Context->BlockIoHandle,
&gEfiBlockIoProtocolGuid,
&DiskImageData->BlockIo,
&gEfiDevicePathProtocolGuid,
&DiskImageData->DevicePath,
NULL
);
+ Context->BlockIoHandle = NULL;
FreePool (DiskImageData);
gBS->FreePages (RamDmgAddress, NumRamDmgPages);
return FALSE;
}
- Context->BlockIoHandle = DiskImageData->Handle;
-
return TRUE;
}
@@ -347,18 +345,13 @@ OcAppleDiskImageUninstallBlockIo (
DiskImageData = OC_APPLE_DISK_IMAGE_MOUNTED_DATA_FROM_THIS (BlockIo);
- ASSERT (
- (DiskImageData->Handle == Context->BlockIoHandle)
- && (DiskImageData->ImageContext == Context)
- );
-
- Status = gBS->DisconnectController (DiskImageData->Handle, NULL, NULL);
+ Status = gBS->DisconnectController (Context->BlockIoHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
return FALSE;
}
Status = gBS->UninstallMultipleProtocolInterfaces (
- DiskImageData->Handle,
+ Context->BlockIoHandle,
&gEfiBlockIoProtocolGuid,
&DiskImageData->BlockIo,
&gEfiDevicePathProtocolGuid,
