Bluetooth: btusb: Fix error return code in btusb_mtk_setup_firmware()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 10 Jul 2019 06:12:22 +0000 (06:12 +0000)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 12 Aug 2019 16:23:49 +0000 (18:23 +0200)
Fix to return error code -EINVAL from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btusb.c

index 3876fee6ad13fa617858d9b1da34ba5b43da13c9..5cf0734eb31bf923de8c18cb8e8ad5d23a284a2f 100644 (file)
@@ -2762,8 +2762,10 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname)
        fw_size = fw->size;
 
        /* The size of patch header is 30 bytes, should be skip */
-       if (fw_size < 30)
+       if (fw_size < 30) {
+               err = -EINVAL;
                goto err_release_fw;
+       }
 
        fw_size -= 30;
        fw_ptr += 30;