Преглед изворни кода

HID: roccat: Fix bug that prevented roccat chardev from removing devices

pointer to device was cleared too early. This is fixed now.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Stefan Achatz пре 14 година
родитељ
комит
e6fa47af55
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      drivers/hid/hid-roccat.c

+ 4 - 1
drivers/hid/hid-roccat.c

@@ -356,13 +356,16 @@ void roccat_disconnect(int minor)
 
 	mutex_lock(&devices_lock);
 	device = devices[minor];
-	devices[minor] = NULL;
 	mutex_unlock(&devices_lock);
 
 	device->exist = 0; /* TODO exist maybe not needed */
 
 	device_destroy(device->dev->class, MKDEV(roccat_major, minor));
 
+	mutex_lock(&devices_lock);
+	devices[minor] = NULL;
+	mutex_unlock(&devices_lock);
+	
 	if (device->open) {
 		hid_hw_close(device->hid);
 		wake_up_interruptible(&device->wait);