]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
i2c: Do not use device name after device_unregister
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 17 Jan 2010 18:05:58 +0000 (19:05 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 22:52:21 +0000 (15:52 -0700)
In Linus' tree:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c556752109794a5ff199b80a1673336b4df8433a

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/i2c-core.c

index a10d0d2c4831fa079a55c49cc04aba745ae4ab4e..3d3fb00ce6d47571d6d4984bd5c5c40f450d7598 100644 (file)
@@ -644,6 +644,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
                }
        }
 
+       /* 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);
@@ -654,8 +657,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
        /* free bus id */
        idr_remove(&i2c_adapter_idr, adap->nr);
 
-       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));