]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: refine codes of iSCSI driver.
authorZhang Lubo <lubo.zhang@intel.com>
Fri, 22 Apr 2016 07:18:40 +0000 (15:18 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Fri, 22 Apr 2016 07:41:28 +0000 (15:41 +0800)
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>
MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h

index e55bee8af94d0e25d399f3dd42e8303da8e291c0..5295d346ec26404bf5474ac4ac8e23e037babcc1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The entry point of IScsi driver.\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -339,6 +339,10 @@ ON_ERROR:
 \r
   @retval EFI_SUCCESS           The device was stopped.\r
   @retval EFI_DEVICE_ERROR      The device could not be stopped due to a device error.\r
+  @retval EFI_INVALID_PARAMETER Child handle is NULL.\r
+  @retval EFI_ACCESS_DENIED     The protocol could not be removed from the Handle\r
+                                because its interfaces are being used.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -451,7 +455,10 @@ IScsiDriverBindingStop (
   IScsiPublishIbft ();\r
 \r
   IScsiSessionAbort (&Private->Session);\r
-  IScsiCleanDriverData (Private);\r
+  Status = IScsiCleanDriverData (Private);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   return EFI_SUCCESS;\r
 }\r
index ebd9f5b40dd62c51666423ca7ca8f0368495e105..bb48d8c23883071e2bf77488a79b82e97f78c2cf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Miscellaneous routines for iSCSI driver.\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -587,34 +587,46 @@ IScsiCreateDriverData (
 /**\r
   Clean the iSCSI driver data.\r
 \r
-  @param[in]  Private The iSCSI driver data.\r
+  @param[in]              Private The iSCSI driver data.\r
+\r
+  @retval EFI_SUCCES      The clean operation is successful.\r
+  @retval Others          Other errors as indicated.\r
+\r
 **/\r
-VOID\r
+EFI_STATUS\r
 IScsiCleanDriverData (\r
   IN ISCSI_DRIVER_DATA  *Private\r
   )\r
 {\r
+  EFI_STATUS             Status;\r
+\r
   if (Private->DevicePath != NULL) {\r
-    gBS->UninstallProtocolInterface (\r
-          Private->ExtScsiPassThruHandle,\r
-          &gEfiDevicePathProtocolGuid,\r
-          Private->DevicePath\r
-          );\r
+    Status = gBS->UninstallProtocolInterface (\r
+                    Private->ExtScsiPassThruHandle,\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    Private->DevicePath\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      goto EXIT;\r
+    }\r
 \r
     FreePool (Private->DevicePath);\r
   }\r
 \r
   if (Private->ExtScsiPassThruHandle != NULL) {\r
-    gBS->UninstallProtocolInterface (\r
-          Private->ExtScsiPassThruHandle,\r
-          &gEfiExtScsiPassThruProtocolGuid,\r
-          &Private->IScsiExtScsiPassThru\r
-          );\r
+    Status = gBS->UninstallProtocolInterface (\r
+                    Private->ExtScsiPassThruHandle,\r
+                    &gEfiExtScsiPassThruProtocolGuid,\r
+                    &Private->IScsiExtScsiPassThru\r
+                    );\r
   }\r
 \r
+EXIT:\r
+\r
   gBS->CloseEvent (Private->ExitBootServiceEvent);\r
 \r
   FreePool (Private);\r
+  return Status;\r
 }\r
 \r
 /**\r
index 8a95493dcd3f52b6ad79322579c06e5ff332255b..0ab44d06aebd000f66e5802a53575c91eb2be1b4 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Miscellaneous definitions for iSCSI driver.\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -219,9 +219,12 @@ IScsiCreateDriverData (
 /**\r
   Clean the iSCSI driver data.\r
 \r
-  @param[in]  Private The iSCSI driver data.\r
+  @param[in]               Private The iSCSI driver data.\r
+\r
+  @retval EFI_SUCCES       The clean operation is successful.\r
+  @retval Others           Other errors as indicated.\r
 **/\r
-VOID\r
+EFI_STATUS\r
 IScsiCleanDriverData (\r
   IN ISCSI_DRIVER_DATA  *Private\r
   );\r