diff options
author | Zhang Lubo <lubo.zhang@intel.com> | 2016-04-22 15:18:40 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-04-22 15:41:28 +0800 |
commit | e3761c71d98d917175f68d25945fd687c65fd95f (patch) | |
tree | bda3ce47ad229268bae08483307cd71b9b6551a0 | |
parent | 74a88770337121b046ec5f055d4ae06abc37fa60 (diff) | |
download | edk2-e3761c71d98d917175f68d25945fd687c65fd95f.tar.gz edk2-e3761c71d98d917175f68d25945fd687c65fd95f.tar.bz2 edk2-e3761c71d98d917175f68d25945fd687c65fd95f.zip |
MdeModulePkg: refine codes of iSCSI driver.
Add error handling logic in DriverBingingStop function,
it may return error status when invoking the
UninstallProtocolInterface.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
-rw-r--r-- | MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c | 11 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 38 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h | 9 |
3 files changed, 40 insertions, 18 deletions
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c index e55bee8af9..5295d346ec 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c @@ -1,7 +1,7 @@ /** @file
The entry point of IScsi driver.
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -339,6 +339,10 @@ ON_ERROR: @retval EFI_SUCCESS The device was stopped.
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
+ @retval EFI_INVALID_PARAMETER Child handle is NULL.
+ @retval EFI_ACCESS_DENIED The protocol could not be removed from the Handle
+ because its interfaces are being used.
+
**/
EFI_STATUS
EFIAPI
@@ -451,7 +455,10 @@ IScsiDriverBindingStop ( IScsiPublishIbft ();
IScsiSessionAbort (&Private->Session);
- IScsiCleanDriverData (Private);
+ Status = IScsiCleanDriverData (Private);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c index ebd9f5b40d..bb48d8c238 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c @@ -1,7 +1,7 @@ /** @file
Miscellaneous routines for iSCSI driver.
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -587,34 +587,46 @@ IScsiCreateDriverData ( /**
Clean the iSCSI driver data.
- @param[in] Private The iSCSI driver data.
+ @param[in] Private The iSCSI driver data.
+
+ @retval EFI_SUCCES The clean operation is successful.
+ @retval Others Other errors as indicated.
+
**/
-VOID
+EFI_STATUS
IScsiCleanDriverData (
IN ISCSI_DRIVER_DATA *Private
)
{
+ EFI_STATUS Status;
+
if (Private->DevicePath != NULL) {
- gBS->UninstallProtocolInterface (
- Private->ExtScsiPassThruHandle,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath
- );
+ Status = gBS->UninstallProtocolInterface (
+ Private->ExtScsiPassThruHandle,
+ &gEfiDevicePathProtocolGuid,
+ Private->DevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ goto EXIT;
+ }
FreePool (Private->DevicePath);
}
if (Private->ExtScsiPassThruHandle != NULL) {
- gBS->UninstallProtocolInterface (
- Private->ExtScsiPassThruHandle,
- &gEfiExtScsiPassThruProtocolGuid,
- &Private->IScsiExtScsiPassThru
- );
+ Status = gBS->UninstallProtocolInterface (
+ Private->ExtScsiPassThruHandle,
+ &gEfiExtScsiPassThruProtocolGuid,
+ &Private->IScsiExtScsiPassThru
+ );
}
+EXIT:
+
gBS->CloseEvent (Private->ExitBootServiceEvent);
FreePool (Private);
+ return Status;
}
/**
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h index 8a95493dcd..0ab44d06ae 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h @@ -1,7 +1,7 @@ /** @file
Miscellaneous definitions for iSCSI driver.
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -219,9 +219,12 @@ IScsiCreateDriverData ( /**
Clean the iSCSI driver data.
- @param[in] Private The iSCSI driver data.
+ @param[in] Private The iSCSI driver data.
+
+ @retval EFI_SUCCES The clean operation is successful.
+ @retval Others Other errors as indicated.
**/
-VOID
+EFI_STATUS
IScsiCleanDriverData (
IN ISCSI_DRIVER_DATA *Private
);
|