mirror of https://github.com/acidanthera/audk.git
add error handler in return places.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9119 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b635c7684e
commit
73f8ef8c08
|
@ -712,12 +712,14 @@ ON_ERROR:
|
||||||
if (UsbMass != NULL) {
|
if (UsbMass != NULL) {
|
||||||
FreePool (UsbMass);
|
FreePool (UsbMass);
|
||||||
}
|
}
|
||||||
gBS->CloseProtocol (
|
if (UsbIo != NULL) {
|
||||||
Controller,
|
gBS->CloseProtocol (
|
||||||
&gEfiUsbIoProtocolGuid,
|
Controller,
|
||||||
This->DriverBindingHandle,
|
&gEfiUsbIoProtocolGuid,
|
||||||
Controller
|
This->DriverBindingHandle,
|
||||||
);
|
Controller
|
||||||
|
);
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,6 +832,7 @@ USBMassDriverBindingStart (
|
||||||
VOID *Context;
|
VOID *Context;
|
||||||
UINT8 MaxLun;
|
UINT8 MaxLun;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
EFI_USB_IO_PROTOCOL *UsbIo;
|
||||||
|
|
||||||
Transport = NULL;
|
Transport = NULL;
|
||||||
Context = NULL;
|
Context = NULL;
|
||||||
|
@ -867,18 +870,44 @@ USBMassDriverBindingStart (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
Controller,
|
||||||
|
&gEfiUsbIoProtocolGuid,
|
||||||
|
(VOID **) &UsbIo,
|
||||||
|
This->DriverBindingHandle,
|
||||||
|
Controller,
|
||||||
|
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: OpenUsbIoProtocol By Driver (%r)\n", Status));
|
||||||
|
gBS->CloseProtocol (
|
||||||
|
Controller,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
This->DriverBindingHandle,
|
||||||
|
Controller
|
||||||
|
);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize data for device that supports multiple LUNSs.
|
// Initialize data for device that supports multiple LUNSs.
|
||||||
// EFI_SUCCESS is returned if at least 1 LUN is initialized successfully.
|
// EFI_SUCCESS is returned if at least 1 LUN is initialized successfully.
|
||||||
//
|
//
|
||||||
Status = UsbMassInitMultiLun (This, Controller, Transport, Context, DevicePath, MaxLun);
|
Status = UsbMassInitMultiLun (This, Controller, Transport, Context, DevicePath, MaxLun);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
Controller,
|
Controller,
|
||||||
&gEfiDevicePathProtocolGuid,
|
&gEfiDevicePathProtocolGuid,
|
||||||
This->DriverBindingHandle,
|
This->DriverBindingHandle,
|
||||||
Controller
|
Controller
|
||||||
);
|
);
|
||||||
|
gBS->CloseProtocol (
|
||||||
|
Controller,
|
||||||
|
&gEfiUsbIoProtocolGuid,
|
||||||
|
This->DriverBindingHandle,
|
||||||
|
Controller
|
||||||
|
);
|
||||||
DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitMultiLun (%r) with Maxlun=%d\n", Status, MaxLun));
|
DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitMultiLun (%r) with Maxlun=%d\n", Status, MaxLun));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,9 +948,9 @@ USBMassDriverBindingStop (
|
||||||
//
|
//
|
||||||
// This is a bus driver stop function since multi-lun is supported.
|
// This is a bus driver stop function since multi-lun is supported.
|
||||||
// There are three kinds of device handles that might be passed:
|
// There are three kinds of device handles that might be passed:
|
||||||
// 1st is a handle with Device Path & USB I/O & Block I/O installed (non-multi-lun)
|
// 1st is a handle with USB I/O & Block I/O installed (non-multi-lun)
|
||||||
// 2nd is a handle with Device Path & USB I/O installed (multi-lun root)
|
// 2nd is a handle with Device Path & USB I/O installed (multi-lun root)
|
||||||
// 3rd is a handle with Device Path & Block I/O installed (multi-lun).
|
// 3rd is a handle with Device Path & USB I/O & Block I/O installed (multi-lun).
|
||||||
//
|
//
|
||||||
if (NumberOfChildren == 0) {
|
if (NumberOfChildren == 0) {
|
||||||
//
|
//
|
||||||
|
@ -938,8 +967,8 @@ USBMassDriverBindingStop (
|
||||||
|
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
//
|
//
|
||||||
// This is a 2nd type handle(multi-lun root), which only needs to close
|
// This is a 2nd type handle(multi-lun root), it needs to close devicepath
|
||||||
// Device Path Protocol.
|
// and usbio protocol.
|
||||||
//
|
//
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
Controller,
|
Controller,
|
||||||
|
@ -947,6 +976,12 @@ USBMassDriverBindingStop (
|
||||||
This->DriverBindingHandle,
|
This->DriverBindingHandle,
|
||||||
Controller
|
Controller
|
||||||
);
|
);
|
||||||
|
gBS->CloseProtocol (
|
||||||
|
Controller,
|
||||||
|
&gEfiUsbIoProtocolGuid,
|
||||||
|
This->DriverBindingHandle,
|
||||||
|
Controller
|
||||||
|
);
|
||||||
DEBUG ((EFI_D_INFO, "Success to stop multi-lun root handle\n"));
|
DEBUG ((EFI_D_INFO, "Success to stop multi-lun root handle\n"));
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue