X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FBus%2FI2c%2FI2cDxe%2FI2cBus.c;h=cad5ad7d44a012c7dfbacb38fa7b222706628fe6;hp=02c3a0e353f74702591f4235d8ec14a34958b435;hb=1d956501fe94a3661e501c6fa1d699f442cf4c79;hpb=6f497f8f71fa1c38b0b0204ff06f1d6d8256d8f1 diff --git a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c index 02c3a0e353..cad5ad7d44 100644 --- a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c +++ b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c @@ -2,7 +2,7 @@ This file implements I2C IO Protocol which enables the user to manipulate a single I2C device independent of the host controller and I2C design. - Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1108,14 +1108,11 @@ RegisterI2cDevice ( queued when Event is not NULL. @retval EFI_SUCCESS The transaction completed successfully when Event is NULL. - @retval EFI_ABORTED The request did not complete because the driver - binding Stop() routine was called. @retval EFI_BAD_BUFFER_SIZE The RequestPacket->LengthInBytes value is too large. @retval EFI_DEVICE_ERROR There was an I2C error (NACK) during the transaction. @retval EFI_INVALID_PARAMETER RequestPacket is NULL - @retval EFI_NOT_FOUND Reserved bit set in the SlaveAddress parameter @retval EFI_NO_MAPPING The EFI_I2C_HOST_PROTOCOL could not set the bus configuration required to access this I2C device. @@ -1424,22 +1421,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; + } } }