NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in Driver Binding Start.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447

This patch is to uninstall Ip6ServiceBindingProtocol and Ip6ConfigProtocol when
error happen in Driver Binding Start.

Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Signed-off-by: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-By: Ye Ting <ting.ye@intel.com>
This commit is contained in:
Jiaxin Wu 2019-01-25 08:53:48 +08:00
parent 463d994f9c
commit 2d66393219
1 changed files with 19 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/** @file
The driver binding and service binding protocol for IP6 driver.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
@ -564,7 +564,7 @@ Ip6DriverBindingStart (
NULL
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
goto FREE_SERVICE;
}
//
@ -573,7 +573,7 @@ Ip6DriverBindingStart (
//
Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
goto UNINSTALL_PROTOCOL;
}
//
@ -588,7 +588,7 @@ Ip6DriverBindingStart (
DataItem->Data.Ptr
);
if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
goto ON_ERROR;
goto UNINSTALL_PROTOCOL;
}
}
@ -604,7 +604,7 @@ Ip6DriverBindingStart (
DataItem->Data.Ptr
);
if (EFI_ERROR(Status)) {
goto ON_ERROR;
goto UNINSTALL_PROTOCOL;
}
}
@ -613,7 +613,7 @@ Ip6DriverBindingStart (
//
Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
goto UNINSTALL_PROTOCOL;
}
//
@ -625,7 +625,7 @@ Ip6DriverBindingStart (
TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
goto UNINSTALL_PROTOCOL;
}
//
@ -637,7 +637,7 @@ Ip6DriverBindingStart (
TICKS_PER_MS * IP6_ONE_SECOND_IN_MS
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
goto UNINSTALL_PROTOCOL;
}
//
@ -647,7 +647,17 @@ Ip6DriverBindingStart (
return EFI_SUCCESS;
ON_ERROR:
UNINSTALL_PROTOCOL:
gBS->UninstallMultipleProtocolInterfaces (
ControllerHandle,
&gEfiIp6ServiceBindingProtocolGuid,
&IpSb->ServiceBinding,
&gEfiIp6ConfigProtocolGuid,
Ip6Cfg,
NULL
);
FREE_SERVICE:
Ip6CleanService (IpSb);
FreePool (IpSb);
return Status;