diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2020-07-21 10:37:16 +0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2020-07-28 09:17:19 +0200 |
commit | 202798db9570104728dce8bb57dfeed47ce764bc (patch) | |
tree | 778c6e0af159b32c64094731470978c2047cb072 /drivers/bluetooth/hci_serdev.c | |
parent | 24b065727ceba53cc5bec0e725672417154df24f (diff) | |
download | lwn-202798db9570104728dce8bb57dfeed47ce764bc.tar.gz lwn-202798db9570104728dce8bb57dfeed47ce764bc.zip |
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: c34dc3bfa7642fd ("Bluetooth: hci_serdev: Introduce hci_uart_unregister_device()")
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/hci_serdev.c')
-rw-r--r-- | drivers/bluetooth/hci_serdev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index 599855e4c57c..7b233312e723 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -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); |