If the driver does not start before, we do not disconnect driver and we must still uninstall other protocols on image handle. The original implementation of error return is not correct.

Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15069 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Elvin Li 2014-01-09 08:47:03 +00:00 committed by li-elvin
parent e6aaef28b8
commit 2fa77862fd
2 changed files with 28 additions and 32 deletions

View File

@ -1424,22 +1424,20 @@ I2cBusUnload (
&DeviceHandleBuffer
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Disconnect the driver specified by Driver BindingHandle from all
// the devices in the handle database.
//
for (Index = 0; Index < DeviceHandleCount; Index++) {
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
gI2cBusDriverBinding.DriverBindingHandle,
NULL
);
if (EFI_ERROR (Status)) {
goto Done;
if (!EFI_ERROR (Status)) {
//
// Disconnect the driver specified by Driver BindingHandle from all
// the devices in the handle database.
//
for (Index = 0; Index < DeviceHandleCount; Index++) {
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
gI2cBusDriverBinding.DriverBindingHandle,
NULL
);
if (EFI_ERROR (Status)) {
goto Done;
}
}
}

View File

@ -1147,22 +1147,20 @@ I2cHostUnload (
&DeviceHandleBuffer
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Disconnect the driver specified by ImageHandle from all
// the devices in the handle database.
//
for (Index = 0; Index < DeviceHandleCount; Index++) {
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
ImageHandle,
NULL
);
if (EFI_ERROR (Status)) {
goto Done;
if (!EFI_ERROR (Status)) {
//
// Disconnect the driver specified by ImageHandle from all
// the devices in the handle database.
//
for (Index = 0; Index < DeviceHandleCount; Index++) {
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
ImageHandle,
NULL
);
if (EFI_ERROR (Status)) {
goto Done;
}
}
}