From c4a62a12c2890297cfcb9828b51b058fb347c01a Mon Sep 17 00:00:00 2001 From: vanjeff Date: Tue, 18 Dec 2007 07:01:23 +0000 Subject: Sync the latest version from R8. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4400 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c | 82 ++++++++++------------- 1 file changed, 36 insertions(+), 46 deletions(-) (limited to 'MdeModulePkg/Universal/Network/MnpDxe') diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c index 814566ec56..946ace1f66 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c @@ -219,64 +219,54 @@ MnpDriverBindingStop ( ("MnpDriverBindingStop: Locate MNP Service Binding Protocol failed, %r.\n", Status) ); - goto EXIT; + return EFI_DEVICE_ERROR; } MnpServiceData = MNP_SERVICE_DATA_FROM_THIS (ServiceBinding); - while (!NetListIsEmpty (&MnpServiceData->ChildrenList)) { + if (NumberOfChildren == 0) { // - // Don't use NetListRemoveHead here, the remove opreration will be done - // in ServiceBindingDestroyChild. + // Uninstall the MNP Service Binding Protocol. // - Instance = NET_LIST_HEAD ( - &MnpServiceData->ChildrenList, - MNP_INSTANCE_DATA, - InstEntry - ); - - ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); - } + gBS->UninstallMultipleProtocolInterfaces ( + ControllerHandle, + &gEfiManagedNetworkServiceBindingProtocolGuid, + ServiceBinding, + NULL + ); - // - // Uninstall the MNP Service Binding Protocol. - // - Status = gBS->UninstallMultipleProtocolInterfaces ( - ControllerHandle, - &gEfiManagedNetworkServiceBindingProtocolGuid, - ServiceBinding, - NULL - ); - if (EFI_ERROR (Status)) { + // + // Close the openned Snp protocol. + // + gBS->CloseProtocol ( + ControllerHandle, + &gEfiSimpleNetworkProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); - MNP_DEBUG_ERROR (("MnpDriverBindingStop: Uninstall MNP Service Binding Protocol failed, %r.\n")); - goto EXIT; - } + // + // Flush the Mnp service data. + // + MnpFlushServiceData (MnpServiceData); - // - // Close the openned Snp protocol. - // - Status = gBS->CloseProtocol ( - ControllerHandle, - &gEfiSimpleNetworkProtocolGuid, - This->DriverBindingHandle, - ControllerHandle - ); - if (EFI_ERROR (Status)) { + NetFreePool (MnpServiceData); + } else { + while (!NetListIsEmpty (&MnpServiceData->ChildrenList)) { + // + // Don't use NetListRemoveHead here, the remove opreration will be done + // in ServiceBindingDestroyChild. + // + Instance = NET_LIST_HEAD ( + &MnpServiceData->ChildrenList, + MNP_INSTANCE_DATA, + InstEntry + ); - MNP_DEBUG_ERROR (("MnpDriverBindingStop: Close SNP Protocol failed, %r.\n", Status)); - goto EXIT; + ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); + } } - // - // Flush the Mnp service data. - // - MnpFlushServiceData (MnpServiceData); - - NetFreePool (MnpServiceData); - -EXIT: - return Status; } -- cgit v1.2.3