X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FArpDxe%2FArpDriver.c;h=aa99ff5b51f001ddf78503a149c01498b7eddaf3;hp=af2e082576e1918748a8d0600cfa84a73874b686;hb=c4a62a12c2890297cfcb9828b51b058fb347c01a;hpb=372787b85a2a6a6da0a7b0357f58953da26d81a8 diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c index af2e082576..aa99ff5b51 100644 --- a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c +++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c @@ -413,7 +413,7 @@ ArpDriverBindingStop ( // NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiManagedNetworkProtocolGuid); if (NicHandle == NULL) { - return EFI_SUCCESS; + return EFI_DEVICE_ERROR; } // @@ -429,50 +429,43 @@ ArpDriverBindingStop ( ); if (EFI_ERROR (Status)) { ARP_DEBUG_ERROR (("ArpDriverBindingStop: Open ArpSb failed, %r.\n", Status)); - return Status; + return EFI_DEVICE_ERROR; } ArpService = ARP_SERVICE_DATA_FROM_THIS (ServiceBinding); - while (!NetListIsEmpty (&ArpService->ChildrenList)) { + if (NumberOfChildren == 0) { // - // Iterate all the instances. + // Uninstall the ARP ServiceBinding protocol. // - Instance = NET_LIST_HEAD (&ArpService->ChildrenList, ARP_INSTANCE_DATA, List); + gBS->UninstallMultipleProtocolInterfaces ( + NicHandle, + &gEfiArpServiceBindingProtocolGuid, + &ArpService->ServiceBinding, + NULL + ); // - // Destroy this arp child. + // Clean the arp servicebinding context data and free the memory allocated. // - ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); - } + ArpCleanService (ArpService); - ASSERT (NetListIsEmpty (&ArpService->PendingRequestTable)); - ASSERT (NetListIsEmpty (&ArpService->DeniedCacheTable)); - ASSERT (NetListIsEmpty (&ArpService->ResolvedCacheTable)); + NetFreePool (ArpService); + } else { - // - // Uninstall the ARP ServiceBinding protocol. - // - Status = gBS->UninstallMultipleProtocolInterfaces ( - NicHandle, - &gEfiArpServiceBindingProtocolGuid, - &ArpService->ServiceBinding, - NULL - ); - if (EFI_ERROR (Status)) { - ARP_DEBUG_ERROR (("ArpDriverBindingStop: Failed to uninstall ArpSb, %r.\n", Status)); - return Status; - } + while (!NetListIsEmpty (&ArpService->ChildrenList)) { + Instance = NET_LIST_HEAD (&ArpService->ChildrenList, ARP_INSTANCE_DATA, List); - // - // Clean the arp servicebinding context data and free the memory allocated. - // - ArpCleanService (ArpService); - NetFreePool (ArpService); + ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); + } - return Status; -} + ASSERT (NetListIsEmpty (&ArpService->PendingRequestTable)); + ASSERT (NetListIsEmpty (&ArpService->DeniedCacheTable)); + ASSERT (NetListIsEmpty (&ArpService->ResolvedCacheTable)); + } + return EFI_SUCCESS; +} /** Creates a child handle with a set of I/O services.