X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FMnpDxe%2FMnpDriver.c;h=946ace1f66a25178cdccb0913adf31d8007970fc;hb=c4a62a12c2890297cfcb9828b51b058fb347c01a;hp=814566ec56c647213fec7e7494d66b0d4f7b1f49;hpb=372787b85a2a6a6da0a7b0357f58953da26d81a8;p=mirror_edk2.git 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; }