diff mbox

[1/2] drivers/hid: Eliminate a double lock

Message ID Pine.LNX.4.64.1006201324170.4366@ask.diku.dk (mailing list archive)
State Accepted
Commit ca9fe1588427f246ad4c389b0170b29a432804b6
Headers show

Commit Message

Julia Lawall June 20, 2010, 11:24 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index c940267..850d02a 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -949,8 +949,8 @@  static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
 	int ret = 0, len;
 	DECLARE_WAITQUEUE(wait, current);
 
+	mutex_lock(&list->read_mutex);
 	while (ret == 0) {
-		mutex_lock(&list->read_mutex);
 		if (list->head == list->tail) {
 			add_wait_queue(&list->hdev->debug_wait, &wait);
 			set_current_state(TASK_INTERRUPTIBLE);