Commit d30d2111 authored by Nicolas Boichat's avatar Nicolas Boichat Committed by Greg Kroah-Hartman

Bluetooth: hci_serdev: Only unregister device if it was registered

[ Upstream commit 202798db ]

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>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a8acb2bd
......@@ -369,7 +369,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