Bluetooth: mediatek: fix up an error path to restore bdev->tx_state
authorSean Wang <sean.wang@mediatek.com>
Thu, 14 Feb 2019 23:19:35 +0000 (07:19 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 18 Feb 2019 13:06:38 +0000 (14:06 +0100)
Restore bdev->tx_state with clearing bit BTMTKUART_TX_WAIT_VND_EVT
when there is an error on waiting for the corresponding event.

Fixes: 7237c4c9ec92 ("Bluetooth: mediatek: Add protocol support for MediaTek serial devices")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btmtkuart.c

index b8ea011..9f8177b 100644 (file)
@@ -115,11 +115,13 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, u8 op, u8 flag, u16 plen,
                                  TASK_INTERRUPTIBLE, HCI_INIT_TIMEOUT);
        if (err == -EINTR) {
                bt_dev_err(hdev, "Execution of wmt command interrupted");
+               clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
                return err;
        }
 
        if (err) {
                bt_dev_err(hdev, "Execution of wmt command timed out");
+               clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
                return -ETIMEDOUT;
        }