From: Thadeu Lima de Souza Cascardo Date: Sat, 16 Jan 2010 19:43:13 +0000 (+0100) Subject: i2c: Do not use device name after device_unregister X-Git-Tag: firefly_0821_release~11625^2~306 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c1f77a7025d7802dc29ca1a8fe84e416973525ed;p=firefly-linux-kernel-4.4.55.git i2c: Do not use device name after device_unregister commit c556752109794a5ff199b80a1673336b4df8433a upstream. 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 Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 296504355142..3bf7b0a270f5 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -801,6 +801,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); @@ -813,8 +816,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));