提交 53cce22d 编写于 作者: J Johan Hedberg 提交者: Gustavo Padovan

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: NJohan Hedberg <johan.hedberg@intel.com>
Acked-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
上级 01178cd4
......@@ -122,6 +122,14 @@ static int __hci_req_sync(struct hci_dev *hdev,
set_current_state(TASK_INTERRUPTIBLE);
req(hdev, opt);
/* If the request didn't send any commands return immediately */
if (skb_queue_empty(&hdev->cmd_q) && atomic_read(&hdev->cmd_cnt)) {
hdev->req_status = 0;
remove_wait_queue(&hdev->req_wait_q, &wait);
return err;
}
schedule_timeout(timeout);
remove_wait_queue(&hdev->req_wait_q, &wait);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册