Input: fix resetting name, phys and uniq when unregistering device
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 27 Jun 2006 12:30:31 +0000 (08:30 -0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 27 Jun 2006 21:05:06 +0000 (14:05 -0700)
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>
drivers/input/input.c

index de2e7546b491a8878da0677fc40694ec4ba99b3e..a90486f5e49127bf3bbae494d8502d86835f412c 100644 (file)
@@ -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);