diff options
author | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-10-18 17:07:24 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-10-18 17:07:24 +0000 |
commit | c8c2e4d61339592056931dff5c209b7d06fb466c (patch) | |
tree | 0704995bc91a09dc60fe88a5430a8ef494733cd7 /OvmfPkg/VirtioBlkDxe | |
parent | 74418fe9630195f7a581e4bc566b523e41b79435 (diff) | |
download | edk2-c8c2e4d61339592056931dff5c209b7d06fb466c.tar.gz edk2-c8c2e4d61339592056931dff5c209b7d06fb466c.tar.bz2 edk2-c8c2e4d61339592056931dff5c209b7d06fb466c.zip |
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
Diffstat (limited to 'OvmfPkg/VirtioBlkDxe')
-rw-r--r-- | OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c index 199b9dd0ae..b2bfcdf7b7 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c @@ -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);
|