From f554ff80339b4005856e6a86454d6ea2bb962ee5 Mon Sep 17 00:00:00 2001 From: Amit Nagal Date: Tue, 27 Sep 2011 13:41:58 -0400 Subject: 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 Signed-off-by: Jiri Kosina diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a8c2b7b..6d65d4e 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) { -- cgit v0.10.2