From: Ben Hutchings Date: Wed, 4 Mar 2009 09:53:02 +0000 (+0000) Subject: sfc: Clear I2C adapter structure in falcon_remove_nic() X-Git-Tag: MMI-PSA29.97-13-9~29230^2~365 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8c870379d2db81a11ede65e9fd9774e4e6efe84a;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git sfc: Clear I2C adapter structure in falcon_remove_nic() i2c_del_adapter() leaves dangling pointers in the structure. If we retry the NIC probe and pass the structure to i2c_add_adapter() again it will lead to an oops unless we clear it first. Signed-off-by: Ben Hutchings Signed-off-by: David S. Miller --- diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 9e2f0f0d47a8..efd121c42a21 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c @@ -3114,8 +3114,10 @@ void falcon_remove_nic(struct efx_nic *efx) struct falcon_nic_data *nic_data = efx->nic_data; int rc; + /* Remove I2C adapter and clear it in preparation for a retry */ rc = i2c_del_adapter(&efx->i2c_adap); BUG_ON(rc); + memset(&efx->i2c_adap, 0, sizeof(efx->i2c_adap)); falcon_remove_spi_devices(efx); falcon_free_buffer(efx, &efx->irq_status);