]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Snp.c
Fix a bug in snp driver binding Start() that it may return incorrect status code.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Snp.c
index f1fea0cff44f923fef3e3330bacbfd016198d7a2..177d0a913dfecb5f6354c2170e526ba958b3c247 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of driver entry point and driver binding protocol.\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed\r
 and made available under the terms and conditions of the BSD License which\r
 accompanies this distribution. The full text of the license may be found at\r
@@ -258,7 +258,7 @@ Done:
                                device to start.\r
 \r
   @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
-  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval EFI_DEVICE_ERROR     This driver could not be started due to a device error\r
   @retval other                This driver does not support this device\r
 \r
 **/\r
@@ -698,11 +698,11 @@ SimpleNetworkDriverStart (
     return Status;\r
   }\r
 \r
-  Status = mPciIo->FreeBuffer (\r
-                        mPciIo,\r
-                        SNP_MEM_PAGES (4096),\r
-                        Snp->Cpb\r
-                        );\r
+  mPciIo->FreeBuffer (\r
+            mPciIo,\r
+            SNP_MEM_PAGES (4096),\r
+            Snp->Cpb\r
+            );\r
 \r
 Error_DeleteSNP:\r
 \r
@@ -726,6 +726,13 @@ NiiError:
         Controller\r
         );\r
 \r
+  //\r
+  // If we got here that means we are in error state.\r
+  //\r
+  if (!EFI_ERROR (Status)) {\r
+    Status = EFI_DEVICE_ERROR;\r
+  }\r
+\r
   return Status;\r
 }\r
 \r