HID: hidraw: open count should not increase if error

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>
This commit is contained in:
Amit Nagal 2011-09-27 13:41:58 -04:00 committed by Jiri Kosina
parent 9561f7faa4
commit f554ff8033

View File

@ -272,8 +272,10 @@ static int hidraw_open(struct inode *inode, struct file *file)
dev = hidraw_table[minor]; dev = hidraw_table[minor];
if (!dev->open++) { if (!dev->open++) {
err = hid_hw_power(dev->hid, PM_HINT_FULLON); err = hid_hw_power(dev->hid, PM_HINT_FULLON);
if (err < 0) if (err < 0) {
dev->open--;
goto out_unlock; goto out_unlock;
}
err = hid_hw_open(dev->hid); err = hid_hw_open(dev->hid);
if (err < 0) { if (err < 0) {