Commit c5567521 authored by Thadeu Lima de Souza Cascardo's avatar Thadeu Lima de Souza Cascardo Committed by Jean Delvare

i2c: Do not use device name after device_unregister

dev_dbg outputs dev_name, which is released with device_unregister. This bug
resulted in output like this:

i2c Xy2�0: adapter [SMBus I801 adapter at 1880] unregistered

The right output would be:
i2c i2c-0: adapter [SMBus I801 adapter at 1880] unregistered
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 22f8b269
...@@ -843,6 +843,9 @@ int i2c_del_adapter(struct i2c_adapter *adap) ...@@ -843,6 +843,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
adap->dev.parent); adap->dev.parent);
#endif #endif
/* device name is gone after device_unregister */
dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
/* clean up the sysfs representation */ /* clean up the sysfs representation */
init_completion(&adap->dev_released); init_completion(&adap->dev_released);
device_unregister(&adap->dev); device_unregister(&adap->dev);
...@@ -855,8 +858,6 @@ int i2c_del_adapter(struct i2c_adapter *adap) ...@@ -855,8 +858,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
idr_remove(&i2c_adapter_idr, adap->nr); idr_remove(&i2c_adapter_idr, adap->nr);
mutex_unlock(&core_lock); mutex_unlock(&core_lock);
dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
/* Clear the device structure in case this adapter is ever going to be /* Clear the device structure in case this adapter is ever going to be
added again */ added again */
memset(&adap->dev, 0, sizeof(adap->dev)); memset(&adap->dev, 0, sizeof(adap->dev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment