summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-roccat.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-03 14:53:22 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-03 14:53:22 (GMT)
commit30307c69d59b14723fbf8a524847b302388c702d (patch)
treee6aa7eb7e6b5c567d0f07a3e956ffd9c0b70f3cd /drivers/hid/hid-roccat.c
parent4536e4d1d21c8172402a2217b0fa1880665ace36 (diff)
parentd682bd7f38b73e5dff0b5584c8ec301ccf76e4db (diff)
downloadlinux-fsl-qoriq-30307c69d59b14723fbf8a524847b302388c702d.tar.xz
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: Revert "HID: multitouch: decide if hid-multitouch needs to handle mt devices" HID: drivers/hid/hid-roccat.c: eliminate a null pointer dereference HID: hid-apple: add device ID of another wireless aluminium HID: Add device IDs for Macbook Pro 8 keyboards
Diffstat (limited to 'drivers/hid/hid-roccat.c')
-rw-r--r--drivers/hid/hid-roccat.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index 5666e75..56ce12c 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -162,27 +162,27 @@ static int roccat_open(struct inode *inode, struct file *file)
device = devices[minor];
- mutex_lock(&device->readers_lock);
-
if (!device) {
pr_emerg("roccat device with minor %d doesn't exist\n", minor);
error = -ENODEV;
- goto exit_err;
+ goto exit_err_devices;
}
+ mutex_lock(&device->readers_lock);
+
if (!device->open++) {
/* power on device on adding first reader */
error = hid_hw_power(device->hid, PM_HINT_FULLON);
if (error < 0) {
--device->open;
- goto exit_err;
+ goto exit_err_readers;
}
error = hid_hw_open(device->hid);
if (error < 0) {
hid_hw_power(device->hid, PM_HINT_NORMAL);
--device->open;
- goto exit_err;
+ goto exit_err_readers;
}
}
@@ -193,13 +193,13 @@ static int roccat_open(struct inode *inode, struct file *file)
list_add_tail(&reader->node, &device->readers);
file->private_data = reader;
-exit_unlock:
+exit_err_readers:
mutex_unlock(&device->readers_lock);
+exit_err_devices:
mutex_unlock(&devices_lock);
+ if (error)
+ kfree(reader);
return error;
-exit_err:
- kfree(reader);
- goto exit_unlock;
}
static int roccat_release(struct inode *inode, struct file *file)