aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-03-05 13:37:42 -0500
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-03-08 08:40:25 -0500
commit53cce22dc795e73fb48205e3f584f63f4c71c90c (patch)
treeaa671d4a99b4da6594541c974535f8c6e0ce5ad8 /net/bluetooth
parent01178cd420e0134ef3fb4da161ba6390c66913bf (diff)
Bluetooth: Fix __hci_req_sync() handling of empty requests
If a request callback doesn't send any commands __hci_req_sync() should fail imediately instead of waiting for the inevitable timeout to occur. This is particularly important once we start creating requests with conditional command sending which can potentially result in no commands being sent at all. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 551df8a6f983..9369e010c90e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -122,6 +122,14 @@ static int __hci_req_sync(struct hci_dev *hdev,
122 set_current_state(TASK_INTERRUPTIBLE); 122 set_current_state(TASK_INTERRUPTIBLE);
123 123
124 req(hdev, opt); 124 req(hdev, opt);
125
126 /* If the request didn't send any commands return immediately */
127 if (skb_queue_empty(&hdev->cmd_q) && atomic_read(&hdev->cmd_cnt)) {
128 hdev->req_status = 0;
129 remove_wait_queue(&hdev->req_wait_q, &wait);
130 return err;
131 }
132
125 schedule_timeout(timeout); 133 schedule_timeout(timeout);
126 134
127 remove_wait_queue(&hdev->req_wait_q, &wait); 135 remove_wait_queue(&hdev->req_wait_q, &wait);