Skip to content

Commit

Permalink
HID: hidraw: open count should not increase if error
Browse files Browse the repository at this point in the history
In hidraw_open, if hid_hw_power returns with error, hidraw device open count
should not increase.

Signed-off-by: Amit Nagal <helloin.amit@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Amit Nagal authored and Jiri Kosina committed Sep 27, 2011
1 parent 9561f7f commit f554ff8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/hid/hidraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f554ff8

Please sign in to comment.