]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over...
authorMax Chou <max.chou@realtek.com>
Thu, 5 Sep 2019 05:21:57 +0000 (13:21 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 5 Sep 2019 15:27:32 +0000 (17:27 +0200)
Fix the issue that when the FW size is 32K+, it will fail for the download
process because of the incorrect index.

When firmware patch length is over 32K, "dl_cmd->index" may >= 0x80. It
will be thought as "data end" that download process will not complete.
However, driver should recount the index from 1.

Signed-off-by: Max Chou <max.chou@realtek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btrtl.c

index 0354e93e7a7c7e0feaa830f7571b80c3dbc05294..bf3c02be69305cbaffb91c07217c0b003e5d1282 100644 (file)
@@ -401,7 +401,11 @@ static int rtl_download_firmware(struct hci_dev *hdev,
 
                BT_DBG("download fw (%d/%d)", i, frag_num);
 
-               dl_cmd->index = i;
+               if (i > 0x7f)
+                       dl_cmd->index = (i & 0x7f) + 1;
+               else
+                       dl_cmd->index = i;
+
                if (i == (frag_num - 1)) {
                        dl_cmd->index |= 0x80; /* data end */
                        frag_len = fw_len % RTL_FRAG_LEN;