fixed bug in stop() function, that made stop() failure.
[people/mcb30/edk2.git] / edk2 / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcDriver.c
index c8ee1f7..9d26b13 100644 (file)
@@ -444,19 +444,22 @@ PxeBcDriverBindingStop (
   EFI_STATUS                  Status;\r
 \r
   NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiArpProtocolGuid);\r
-\r
   if (NicHandle == NULL) {\r
-\r
     NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp4ProtocolGuid);\r
 \r
     if (NicHandle == NULL) {\r
-\r
-      NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp4ProtocolGuid);\r
+      NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp4ProtocolGuid);\r
 \r
       if (NicHandle == NULL) {\r
+        NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiUdp4ProtocolGuid);\r
 \r
-        return EFI_DEVICE_ERROR;\r
+        if (NicHandle == NULL) {\r
+          NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp4ProtocolGuid);\r
 \r
+          if (NicHandle == NULL) {\r
+            return EFI_DEVICE_ERROR;\r
+          }\r
+        }\r
       }\r
     }\r
   }\r
@@ -526,6 +529,19 @@ PxeBcDriverBindingStop (
       Private->Mtftp4Child\r
       );\r
 \r
+    gBS->CloseProtocol (\r
+          Private->Ip4Child,\r
+          &gEfiIp4ProtocolGuid,\r
+          This->DriverBindingHandle,\r
+          NicHandle\r
+          );\r
+    NetLibDestroyServiceChild (\r
+      NicHandle,\r
+      This->DriverBindingHandle,\r
+      &gEfiIp4ServiceBindingProtocolGuid,\r
+      Private->Ip4Child\r
+      );\r
+\r
     gBS->CloseProtocol (\r
           Private->ArpChild,\r
           &gEfiArpProtocolGuid,\r