diff options
-rw-r--r-- | net/bluetooth/hci_core.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 3fc699db8fb5..5c6439847286 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -95,15 +95,11 @@ static int __hci_req_sync(struct hci_dev *hdev, | |||
95 | 95 | ||
96 | hdev->req_status = HCI_REQ_PEND; | 96 | hdev->req_status = HCI_REQ_PEND; |
97 | 97 | ||
98 | add_wait_queue(&hdev->req_wait_q, &wait); | ||
99 | set_current_state(TASK_INTERRUPTIBLE); | ||
100 | |||
101 | func(&req, opt); | 98 | func(&req, opt); |
102 | 99 | ||
103 | err = hci_req_run(&req, hci_req_sync_complete); | 100 | err = hci_req_run(&req, hci_req_sync_complete); |
104 | if (err < 0) { | 101 | if (err < 0) { |
105 | hdev->req_status = 0; | 102 | hdev->req_status = 0; |
106 | remove_wait_queue(&hdev->req_wait_q, &wait); | ||
107 | /* req_run will fail if the request did not add any | 103 | /* req_run will fail if the request did not add any |
108 | * commands to the queue, something that can happen when | 104 | * commands to the queue, something that can happen when |
109 | * a request with conditionals doesn't trigger any | 105 | * a request with conditionals doesn't trigger any |
@@ -113,6 +109,9 @@ static int __hci_req_sync(struct hci_dev *hdev, | |||
113 | return 0; | 109 | return 0; |
114 | } | 110 | } |
115 | 111 | ||
112 | add_wait_queue(&hdev->req_wait_q, &wait); | ||
113 | set_current_state(TASK_INTERRUPTIBLE); | ||
114 | |||
116 | schedule_timeout(timeout); | 115 | schedule_timeout(timeout); |
117 | 116 | ||
118 | remove_wait_queue(&hdev->req_wait_q, &wait); | 117 | remove_wait_queue(&hdev->req_wait_q, &wait); |