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

index 51ce16911bcb4365a5faf032022f817871d1eab3..12095cb3ffa5d1b16e39a8e63b1bf8c48fe37bbc 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
@@ -323,7 +323,9 @@ IScsiSupported (
   @retval EFI_INVALID_PARAMETER Any input parameter is invalid.\r
   @retval EFI_NOT_FOUND         There is no sufficient information to establish\r
                                 the iScsi session.\r
-  @retval EFI_DEVICE_ERROR      Failed to get TCP connection device path.                              \r
+  @retval EFI_DEVICE_ERROR      Failed to get TCP connection device path.\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
@@ -863,7 +865,10 @@ IScsiStart (
           IScsiSessionAbort (ExistPrivate->Session);\r
         }\r
 \r
-        IScsiCleanDriverData (ExistPrivate);\r
+        Status = IScsiCleanDriverData (ExistPrivate);\r
+        if (EFI_ERROR (Status)) {\r
+          goto ON_ERROR;\r
+        }\r
       }\r
     } else {\r
       //\r
@@ -963,6 +968,9 @@ 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
@@ -1105,7 +1113,11 @@ IScsiStop (
     IScsiSessionAbort (Private->Session);\r
   }\r
 \r
-  IScsiCleanDriverData (Private);\r
+  Status = IScsiCleanDriverData (Private);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   return EFI_SUCCESS;\r
 }\r
index 5fc25a0df0cbaa52de34d58c8403cac4258c34a0..24067179c9188f84387f0006769f9bac35829990 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
@@ -857,10 +857,13 @@ 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
@@ -868,11 +871,14 @@ IScsiCleanDriverData (
   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
@@ -888,9 +894,12 @@ IScsiCleanDriverData (
     }\r
   }\r
 \r
+EXIT:\r
+\r
   gBS->CloseEvent (Private->ExitBootServiceEvent);\r
 \r
   FreePool (Private);\r
+  return Status;\r
 }\r
 \r
 /**\r
index 7c7a6ba4e055b32b3f771d575efc941c14934835..1bcaeb8bcc815cbfb4033eecab359eebe341a5f1 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
@@ -306,10 +306,13 @@ 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