Bluetooth: Simplify request cleanup code
The hci_req_sync_cancel() is just as much related to the request
cleanup as hci_request_cancel_all() is. Just move the former into the
latter and do the cleanup from a single place in hci_dev_do_close().
The important thing is to avoid deadlocks by holding the req_sync
lock: previously hci_request_cancel_all was done right after releasing
the lock and with this patch it's right before taking it.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fb618d6..63fd31d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1523,7 +1523,7 @@
cancel_delayed_work(&hdev->power_off);
- hci_req_sync_cancel(hdev, ENODEV);
+ hci_request_cancel_all(hdev);
hci_req_sync_lock(hdev);
if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
@@ -1625,8 +1625,6 @@
hci_req_sync_unlock(hdev);
- hci_request_cancel_all(hdev);
-
hci_dev_put(hdev);
return 0;
}