提交 e7374e48 编写于 作者: D Dmitry Torokhov 提交者: Linus Torvalds

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: NDmitry Torokhov <dtor@mail.ru>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 d38b6968
...@@ -998,12 +998,13 @@ void input_unregister_device(struct input_dev *dev) ...@@ -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_caps_attr_group);
sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
class_device_unregister(&dev->cdev);
mutex_lock(&dev->mutex); mutex_lock(&dev->mutex);
dev->name = dev->phys = dev->uniq = NULL; dev->name = dev->phys = dev->uniq = NULL;
mutex_unlock(&dev->mutex); mutex_unlock(&dev->mutex);
class_device_unregister(&dev->cdev);
input_wakeup_procfs_readers(); input_wakeup_procfs_readers();
} }
EXPORT_SYMBOL(input_unregister_device); EXPORT_SYMBOL(input_unregister_device);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册