i2c: Do not use device name after device_unregister
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sat, 16 Jan 2010 19:43:13 +0000 (20:43 +0100)
committerJean Delvare <khali@linux-fr.org>
Sat, 16 Jan 2010 19:43:13 +0000 (20:43 +0100)
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: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/i2c-core.c

index d610e995bbfdef8fd0a25224029efbc3060f20d1..10be7b5fbe97e185d141a23881ea3efd0564a6c7 100644 (file)
@@ -843,6 +843,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
                                 adap->dev.parent);
 #endif
 
+       /* device name is gone after device_unregister */
+       dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
+
        /* clean up the sysfs representation */
        init_completion(&adap->dev_released);
        device_unregister(&adap->dev);
@@ -855,8 +858,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
        idr_remove(&i2c_adapter_idr, adap->nr);
        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
           added again */
        memset(&adap->dev, 0, sizeof(adap->dev));