From 469462b109d4344df8b4c5cc4a672100998b43a0 Mon Sep 17 00:00:00 2001 From: sfu5 Date: Fri, 1 Feb 2013 01:10:47 +0000 Subject: [PATCH] Fix a bug in snp driver binding Start() that it may return incorrect status code. Signed-off-by: Ari Zigler Reviewed-by: Ye Ting Reviewed-by: Fu Siyuan git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14115 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Network/SnpDxe/Snp.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c index f1fea0cff4..177d0a913d 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c @@ -1,7 +1,7 @@ /** @file Implementation of driver entry point and driver binding protocol. -Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.
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 @@ -258,7 +258,7 @@ Done: device to start. @retval EFI_SUCCESS This driver is added to ControllerHandle - @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval EFI_DEVICE_ERROR This driver could not be started due to a device error @retval other This driver does not support this device **/ @@ -698,11 +698,11 @@ SimpleNetworkDriverStart ( return Status; } - Status = mPciIo->FreeBuffer ( - mPciIo, - SNP_MEM_PAGES (4096), - Snp->Cpb - ); + mPciIo->FreeBuffer ( + mPciIo, + SNP_MEM_PAGES (4096), + Snp->Cpb + ); Error_DeleteSNP: @@ -726,6 +726,13 @@ NiiError: Controller ); + // + // If we got here that means we are in error state. + // + if (!EFI_ERROR (Status)) { + Status = EFI_DEVICE_ERROR; + } + return Status; }