if (UsbMass != NULL) {\r
FreePool (UsbMass);\r
}\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiUsbIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
+ if (UsbIo != NULL) {\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiUsbIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ }\r
return Status; \r
}\r
\r
VOID *Context;\r
UINT8 MaxLun;\r
EFI_STATUS Status;\r
+ EFI_USB_IO_PROTOCOL *UsbIo; \r
\r
Transport = NULL;\r
Context = NULL;\r
return Status;\r
}\r
\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiUsbIoProtocolGuid,\r
+ (VOID **) &UsbIo,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ \r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: OpenUsbIoProtocol By Driver (%r)\n", Status));\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ return Status;\r
+ }\r
+\r
//\r
// Initialize data for device that supports multiple LUNSs.\r
// EFI_SUCCESS is returned if at least 1 LUN is initialized successfully.\r
//\r
Status = UsbMassInitMultiLun (This, Controller, Transport, Context, DevicePath, MaxLun);\r
if (EFI_ERROR (Status)) {\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiDevicePathProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiUsbIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitMultiLun (%r) with Maxlun=%d\n", Status, MaxLun));\r
}\r
}\r
//\r
// This is a bus driver stop function since multi-lun is supported.\r
// There are three kinds of device handles that might be passed:\r
- // 1st is a handle with Device Path & USB I/O & Block I/O installed (non-multi-lun)\r
+ // 1st is a handle with USB I/O & Block I/O installed (non-multi-lun)\r
// 2nd is a handle with Device Path & USB I/O installed (multi-lun root)\r
- // 3rd is a handle with Device Path & Block I/O installed (multi-lun).\r
+ // 3rd is a handle with Device Path & USB I/O & Block I/O installed (multi-lun).\r
//\r
if (NumberOfChildren == 0) {\r
//\r
\r
if (EFI_ERROR(Status)) {\r
//\r
- // This is a 2nd type handle(multi-lun root), which only needs to close \r
- // Device Path Protocol.\r
+ // This is a 2nd type handle(multi-lun root), it needs to close devicepath\r
+ // and usbio protocol.\r
//\r
gBS->CloseProtocol (\r
Controller,\r
This->DriverBindingHandle,\r
Controller\r
);\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiUsbIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
DEBUG ((EFI_D_INFO, "Success to stop multi-lun root handle\n"));\r
return EFI_SUCCESS;\r
}\r