diff options
Diffstat (limited to 'drivers/hid/usbhid/hiddev.c')
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index ff3c644888b1..7c1188b53c3e 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
248 | usbhid_close(list->hiddev->hid); | 248 | usbhid_close(list->hiddev->hid); |
249 | usbhid_put_power(list->hiddev->hid); | 249 | usbhid_put_power(list->hiddev->hid); |
250 | } else { | 250 | } else { |
251 | mutex_unlock(&list->hiddev->existancelock); | ||
251 | kfree(list->hiddev); | 252 | kfree(list->hiddev); |
253 | kfree(list); | ||
254 | return 0; | ||
252 | } | 255 | } |
253 | } | 256 | } |
254 | 257 | ||
255 | kfree(list); | ||
256 | mutex_unlock(&list->hiddev->existancelock); | 258 | mutex_unlock(&list->hiddev->existancelock); |
259 | kfree(list); | ||
257 | 260 | ||
258 | return 0; | 261 | return 0; |
259 | } | 262 | } |
@@ -923,10 +926,11 @@ void hiddev_disconnect(struct hid_device *hid) | |||
923 | usb_deregister_dev(usbhid->intf, &hiddev_class); | 926 | usb_deregister_dev(usbhid->intf, &hiddev_class); |
924 | 927 | ||
925 | if (hiddev->open) { | 928 | if (hiddev->open) { |
929 | mutex_unlock(&hiddev->existancelock); | ||
926 | usbhid_close(hiddev->hid); | 930 | usbhid_close(hiddev->hid); |
927 | wake_up_interruptible(&hiddev->wait); | 931 | wake_up_interruptible(&hiddev->wait); |
928 | } else { | 932 | } else { |
933 | mutex_unlock(&hiddev->existancelock); | ||
929 | kfree(hiddev); | 934 | kfree(hiddev); |
930 | } | 935 | } |
931 | mutex_unlock(&hiddev->existancelock); | ||
932 | } | 936 | } |