Merge tag 'asoc-fix-v5.17-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / bluetooth / btmtkuart.c
index e9d91d7..9ba22b1 100644 (file)
@@ -158,8 +158,10 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
        int err;
 
        hlen = sizeof(*hdr) + wmt_params->dlen;
-       if (hlen > 255)
-               return -EINVAL;
+       if (hlen > 255) {
+               err = -EINVAL;
+               goto err_free_skb;
+       }
 
        hdr = (struct mtk_wmt_hdr *)&wc;
        hdr->dir = 1;
@@ -173,7 +175,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
        err = __hci_cmd_send(hdev, 0xfc6f, hlen, &wc);
        if (err < 0) {
                clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
-               return err;
+               goto err_free_skb;
        }
 
        /* The vendor specific WMT commands are all answered by a vendor
@@ -190,13 +192,14 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
        if (err == -EINTR) {
                bt_dev_err(hdev, "Execution of wmt command interrupted");
                clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
-               return err;
+               goto err_free_skb;
        }
 
        if (err) {
                bt_dev_err(hdev, "Execution of wmt command timed out");
                clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
-               return -ETIMEDOUT;
+               err = -ETIMEDOUT;
+               goto err_free_skb;
        }
 
        /* Parse and handle the return WMT event */