]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
MdeModulePkg: refine codes of iSCSI driver.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiMisc.c
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