summary refs log tree commit diff
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2006-06-27 08:30:31 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 14:05:06 -0700
commite7374e48009a15a680d53bd1f9828b9b79a8aac9 (patch)
treedd3344add0056eb8f33fde2c3ffeb4fecd0f2baa /drivers/input/input.c
parentd38b69689c349f35502b92e20dafb30c62d49d63 (diff)
downloadlinux-e7374e48009a15a680d53bd1f9828b9b79a8aac9.tar.gz
Input: fix resetting name, phys and uniq when unregistering device
It should be done before calling class_device_unregister() because
it will destroy the device and free memory if there are no other
references to the device.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index de2e7546b491..a90486f5e491 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -998,12 +998,13 @@ void input_unregister_device(struct input_dev *dev)
 	sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
 	sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
 	sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
-	class_device_unregister(&dev->cdev);
 
 	mutex_lock(&dev->mutex);
 	dev->name = dev->phys = dev->uniq = NULL;
 	mutex_unlock(&dev->mutex);
 
+	class_device_unregister(&dev->cdev);
+
 	input_wakeup_procfs_readers();
 }
 EXPORT_SYMBOL(input_unregister_device);