Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f554ff80 authored by Amit Nagal's avatar Amit Nagal Committed by Jiri Kosina
Browse files

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: default avatarAmit Nagal <helloin.amit@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 9561f7fa
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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) {