[PATCH 1/1] HID: hiddev: remove a duplicated check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After commit 9c09b214f30e ("HID: hiddev: avoid opening a disconnected
device"), the original check "list->hiddev->exist" become unnecessary.

Signed-off-by: Zhen Lei <thunder.leizhen@xxxxxxxxxx>
---
 drivers/hid/usbhid/hiddev.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index e421cdf2d1a4ec5..e04cf95fca094a8 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -292,16 +292,16 @@ static int hiddev_open(struct inode *inode, struct file *file)
 		res = -ENODEV;
 		goto bail_unlock;
 	}
-	if (!list->hiddev->open++)
-		if (list->hiddev->exist) {
-			struct hid_device *hid = hiddev->hid;
-			res = hid_hw_power(hid, PM_HINT_FULLON);
-			if (res < 0)
-				goto bail_unlock;
-			res = hid_hw_open(hid);
-			if (res < 0)
-				goto bail_normal_power;
-		}
+	if (!list->hiddev->open++) {
+		struct hid_device *hid = hiddev->hid;
+
+		res = hid_hw_power(hid, PM_HINT_FULLON);
+		if (res < 0)
+			goto bail_unlock;
+		res = hid_hw_open(hid);
+		if (res < 0)
+			goto bail_normal_power;
+	}
 	mutex_unlock(&hiddev->existancelock);
 	return 0;
 bail_normal_power:
-- 
1.8.3





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux