mirror of https://github.com/acidanthera/audk.git
OvmfPkg: VirtioBlkDriverBindingStop: fix incorrect use of UEFI driver model
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13866 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
74418fe963
commit
c8c2e4d613
|
@ -944,18 +944,32 @@ VirtioBlkDriverBindingStop (
|
|||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
{
|
||||
VBLK_DEV *Dev;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
VBLK_DEV *Dev;
|
||||
|
||||
Dev = VIRTIO_BLK_FROM_BLOCK_IO (This);
|
||||
Status = gBS->OpenProtocol (
|
||||
DeviceHandle, // candidate device
|
||||
&gEfiBlockIoProtocolGuid, // retrieve the BlockIo iface
|
||||
(VOID **)&BlockIo, // target pointer
|
||||
This->DriverBindingHandle, // requestor driver identity
|
||||
DeviceHandle, // requesting lookup for dev.
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL // lookup only, no ref. added
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Dev = VIRTIO_BLK_FROM_BLOCK_IO (BlockIo);
|
||||
|
||||
//
|
||||
// If DriverBindingStop() is called with the driver instance still in use,
|
||||
// or any of the parameters are invalid, we've caught a bug.
|
||||
// Handle Stop() requests for in-use driver instances gracefully.
|
||||
//
|
||||
Status = gBS->UninstallProtocolInterface (DeviceHandle,
|
||||
&gEfiBlockIoProtocolGuid, &Dev->BlockIo);
|
||||
ASSERT (Status == EFI_SUCCESS);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
VirtioBlkUninit (Dev);
|
||||
|
||||
|
|
Loading…
Reference in New Issue