Commit 202798db authored by Nicolas Boichat's avatar Nicolas Boichat Committed by Marcel Holtmann

Bluetooth: hci_serdev: Only unregister device if it was registered

We should not call hci_unregister_dev if the device was not
successfully registered.

Fixes: c34dc3bf ("Bluetooth: hci_serdev: Introduce hci_uart_unregister_device()")
Signed-off-by: default avatarNicolas Boichat <drinkcat@chromium.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 24b06572
......@@ -355,7 +355,8 @@ void hci_uart_unregister_device(struct hci_uart *hu)
struct hci_dev *hdev = hu->hdev;
clear_bit(HCI_UART_PROTO_READY, &hu->flags);
hci_unregister_dev(hdev);
if (test_bit(HCI_UART_REGISTERED, &hu->flags))
hci_unregister_dev(hdev);
hci_free_dev(hdev);
cancel_work_sync(&hu->write_work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment