hci_dev_unlock(hdev);
}
-static void mgmt_init_hdev(struct hci_dev *hdev)
+static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev)
{
+ if (!test_and_clear_bit(HCI_PI_MGMT_INIT, &hci_pi(sk)->flags))
+ return;
+
if (!test_and_set_bit(HCI_MGMT, &hdev->dev_flags)) {
INIT_DELAYED_WORK(&hdev->service_cache, service_cache_off);
hci_dev_lock(hdev);
- if (test_and_clear_bit(HCI_PI_MGMT_INIT, &hci_pi(sk)->flags))
- mgmt_init_hdev(hdev);
-
memset(&rp, 0, sizeof(rp));
bacpy(&rp.bdaddr, &hdev->bdaddr);
MGMT_STATUS_INVALID_PARAMS);
goto done;
}
+
+ mgmt_init_hdev(sk, hdev);
}
cp = buf + sizeof(*hdr);