summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2011-10-25 09:58:12 +0200
committerJiri Kosina <jkosina@suse.cz>2011-10-25 09:58:12 +0200
commitf6f12427844516bc8e9cf84f43aca7bbbaa48157 (patch)
treec3ac710e02d65fc08629b25fcfba0e79e0092910 /drivers/hid/hidraw.c
parentb0eae38cebc54e618896d3e6a799939da51a8cac (diff)
parentbca621421c53caf73f36e181d6e5fe41fe0da7a7 (diff)
downloadlinux-f6f12427844516bc8e9cf84f43aca7bbbaa48157.tar.bz2
Merge branch 'upstream-fixes' into for-linus
Conflicts: drivers/hid/hid-wacom.c
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r--drivers/hid/hidraw.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index c79578b5a788..6d65d4e35120 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -272,8 +272,10 @@ static int hidraw_open(struct inode *inode, struct file *file)
dev = hidraw_table[minor];
if (!dev->open++) {
err = hid_hw_power(dev->hid, PM_HINT_FULLON);
- if (err < 0)
+ if (err < 0) {
+ dev->open--;
goto out_unlock;
+ }
err = hid_hw_open(dev->hid);
if (err < 0) {
@@ -510,13 +512,12 @@ void hidraw_disconnect(struct hid_device *hid)
{
struct hidraw *hidraw = hid->hidraw;
+ mutex_lock(&minors_lock);
hidraw->exist = 0;
device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
- mutex_lock(&minors_lock);
hidraw_table[hidraw->minor] = NULL;
- mutex_unlock(&minors_lock);
if (hidraw->open) {
hid_hw_close(hid);
@@ -524,6 +525,7 @@ void hidraw_disconnect(struct hid_device *hid)
} else {
kfree(hidraw);
}
+ mutex_unlock(&minors_lock);
}
EXPORT_SYMBOL_GPL(hidraw_disconnect);