summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorAndre Guedes2013-03-08 15:20:15 +0100
committerGustavo Padovan2013-03-09 21:10:37 +0100
commit920c8300c66566afbf92311152c6e462a310203e (patch)
treee373e31788842b4c159d9e177034f5c8e440fc9a /net/bluetooth/hci_core.c
parentBluetooth: Return ENODATA in hci_req_run (diff)
downloadkernel-qcow2-linux-920c8300c66566afbf92311152c6e462a310203e.tar.gz
kernel-qcow2-linux-920c8300c66566afbf92311152c6e462a310203e.tar.xz
kernel-qcow2-linux-920c8300c66566afbf92311152c6e462a310203e.zip
Bluetooth: Check hci_req_run returning value in __hci_req_sync
Since hci_req_run will be returning more than one error code, we should check its returning value in __hci_req_sync. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index d841046daeda..4603464b91e2 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -100,13 +100,16 @@ static int __hci_req_sync(struct hci_dev *hdev,
err = hci_req_run(&req, hci_req_sync_complete);
if (err < 0) {
hdev->req_status = 0;
- /* req_run will fail if the request did not add any
- * commands to the queue, something that can happen when
- * a request with conditionals doesn't trigger any
- * commands to be sent. This is normal behavior and
- * should not trigger an error return.
+
+ /* ENODATA means the HCI request command queue is empty.
+ * This can happen when a request with conditionals doesn't
+ * trigger any commands to be sent. This is normal behavior
+ * and should not trigger an error return.
*/
- return 0;
+ if (err == -ENODATA)
+ return 0;
+
+ return err;
}
add_wait_queue(&hdev->req_wait_q, &wait);