]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Ip6Dxe/Ip6Driver.c
NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in Driver Binding Start.
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6Driver.c
index 0bda1687f0c447dd81a6f9d168d61e1032085341..4c607125a6ad49a935dfdf9138c0010258ba453b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The driver binding and service binding protocol for IP6 driver.\r
 \r
-  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
 \r
   This program and the accompanying materials\r
@@ -564,7 +564,7 @@ Ip6DriverBindingStart (
                   NULL\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
+    goto FREE_SERVICE;\r
   }\r
 \r
   //\r
@@ -573,7 +573,7 @@ Ip6DriverBindingStart (
   //\r
   Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance);\r
   if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
+    goto UNINSTALL_PROTOCOL;\r
   }\r
 \r
   //\r
@@ -588,7 +588,7 @@ Ip6DriverBindingStart (
                        DataItem->Data.Ptr\r
                        );\r
     if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {\r
-      goto ON_ERROR;\r
+      goto UNINSTALL_PROTOCOL;\r
     }\r
   }\r
 \r
@@ -604,7 +604,7 @@ Ip6DriverBindingStart (
                        DataItem->Data.Ptr\r
                        );\r
     if (EFI_ERROR(Status)) {\r
-      goto ON_ERROR;\r
+      goto UNINSTALL_PROTOCOL;\r
     }\r
   }\r
 \r
@@ -613,7 +613,7 @@ Ip6DriverBindingStart (
   //\r
   Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);\r
   if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
+    goto UNINSTALL_PROTOCOL;\r
   }\r
 \r
   //\r
@@ -625,7 +625,7 @@ Ip6DriverBindingStart (
                   TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
+    goto UNINSTALL_PROTOCOL;\r
   }\r
 \r
   //\r
@@ -637,7 +637,7 @@ Ip6DriverBindingStart (
                   TICKS_PER_MS * IP6_ONE_SECOND_IN_MS\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
+    goto UNINSTALL_PROTOCOL;\r
   }\r
 \r
   //\r
@@ -647,7 +647,17 @@ Ip6DriverBindingStart (
 \r
   return EFI_SUCCESS;\r
 \r
-ON_ERROR:\r
+UNINSTALL_PROTOCOL:\r
+  gBS->UninstallMultipleProtocolInterfaces (\r
+         ControllerHandle,\r
+         &gEfiIp6ServiceBindingProtocolGuid,\r
+         &IpSb->ServiceBinding,\r
+         &gEfiIp6ConfigProtocolGuid,\r
+         Ip6Cfg,\r
+         NULL\r
+         );\r
+\r
+FREE_SERVICE:\r
   Ip6CleanService (IpSb);\r
   FreePool (IpSb);\r
   return Status;\r