Merge tag 'upstream-4.1-rc4' of git://git.infradead.org/linux-ubifs
[firefly-linux-kernel-4.4.55.git] / net / bluetooth / hci_core.c
index 476709bd068a474f7edcac83a4869849ccfb4b17..4663c3dad3f5f676e913cbc9f6a79d5efcecde4e 100644 (file)
@@ -1557,7 +1557,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
 {
        BT_DBG("%s %p", hdev->name, hdev);
 
-       if (!hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
+       if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
+           test_bit(HCI_UP, &hdev->flags)) {
                /* Execute vendor specific shutdown routine */
                if (hdev->shutdown)
                        hdev->shutdown(hdev);