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);