MdeModulePkg ScsiDiskDxe: Close event when SCSI command fails

The functions ScsiRead10CommandEx(), ScsiWrite10CommandEx(),
ScsiRead16CommandEx() and ScsiWrite16CommandEx() in UefiScsiLib will not
signal the event passed from ScsiDiskDxe when error occurs.

In this case, ScsiDiskDxe should close the event passing to these APIs in
UefiScsiLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19449 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Hao Wu 2015-12-22 13:56:30 +00:00 committed by hwu1225
parent fbbb3ff3e0
commit 1f09197d19
1 changed files with 24 additions and 0 deletions

View File

@ -3700,6 +3700,8 @@ ScsiDiskAsyncRead10 (
SCSI_ASYNC_RW_REQUEST *Request; SCSI_ASYNC_RW_REQUEST *Request;
EFI_EVENT AsyncIoEvent; EFI_EVENT AsyncIoEvent;
AsyncIoEvent = NULL;
Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST));
if (Request == NULL) { if (Request == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -3755,6 +3757,10 @@ ScsiDiskAsyncRead10 (
return EFI_SUCCESS; return EFI_SUCCESS;
ErrorExit: ErrorExit:
if (AsyncIoEvent != NULL) {
gBS->CloseEvent (AsyncIoEvent);
}
if (Request != NULL) { if (Request != NULL) {
if (Request->SenseData != NULL) { if (Request->SenseData != NULL) {
FreePool (Request->SenseData); FreePool (Request->SenseData);
@ -3803,6 +3809,8 @@ ScsiDiskAsyncWrite10 (
SCSI_ASYNC_RW_REQUEST *Request; SCSI_ASYNC_RW_REQUEST *Request;
EFI_EVENT AsyncIoEvent; EFI_EVENT AsyncIoEvent;
AsyncIoEvent = NULL;
Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST));
if (Request == NULL) { if (Request == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -3858,6 +3866,10 @@ ScsiDiskAsyncWrite10 (
return EFI_SUCCESS; return EFI_SUCCESS;
ErrorExit: ErrorExit:
if (AsyncIoEvent != NULL) {
gBS->CloseEvent (AsyncIoEvent);
}
if (Request != NULL) { if (Request != NULL) {
if (Request->SenseData != NULL) { if (Request->SenseData != NULL) {
FreePool (Request->SenseData); FreePool (Request->SenseData);
@ -3906,6 +3918,8 @@ ScsiDiskAsyncRead16 (
SCSI_ASYNC_RW_REQUEST *Request; SCSI_ASYNC_RW_REQUEST *Request;
EFI_EVENT AsyncIoEvent; EFI_EVENT AsyncIoEvent;
AsyncIoEvent = NULL;
Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST));
if (Request == NULL) { if (Request == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -3961,6 +3975,10 @@ ScsiDiskAsyncRead16 (
return EFI_SUCCESS; return EFI_SUCCESS;
ErrorExit: ErrorExit:
if (AsyncIoEvent != NULL) {
gBS->CloseEvent (AsyncIoEvent);
}
if (Request != NULL) { if (Request != NULL) {
if (Request->SenseData != NULL) { if (Request->SenseData != NULL) {
FreePool (Request->SenseData); FreePool (Request->SenseData);
@ -4009,6 +4027,8 @@ ScsiDiskAsyncWrite16 (
SCSI_ASYNC_RW_REQUEST *Request; SCSI_ASYNC_RW_REQUEST *Request;
EFI_EVENT AsyncIoEvent; EFI_EVENT AsyncIoEvent;
AsyncIoEvent = NULL;
Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST));
if (Request == NULL) { if (Request == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -4064,6 +4084,10 @@ ScsiDiskAsyncWrite16 (
return EFI_SUCCESS; return EFI_SUCCESS;
ErrorExit: ErrorExit:
if (AsyncIoEvent != NULL) {
gBS->CloseEvent (AsyncIoEvent);
}
if (Request != NULL) { if (Request != NULL) {
if (Request->SenseData != NULL) { if (Request->SenseData != NULL) {
FreePool (Request->SenseData); FreePool (Request->SenseData);