[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190902090809.3409-1-max.chou@realtek.com>
Date: Mon, 2 Sep 2019 17:08:09 +0800
From: <max.chou@...ltek.com>
To: <marcel@...tmann.org>, <johan.hedberg@...il.com>,
<linux-bluetooth@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <alex_lu@...lsil.com.cn>, <max.chou@...ltek.com>
Subject: [PATCH] Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over 32K bytes
From: Max Chou <max.chou@...ltek.com>
Fix the issue that when the FW size is 32K+, it will fail for the download
process because of the incorrect index.
Signed-off-by: Max Chou <max.chou@...ltek.com>
---
drivers/bluetooth/btrtl.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 0354e93e7a7c..215896af0259 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -389,6 +389,7 @@ static int rtl_download_firmware(struct hci_dev *hdev,
int frag_len = RTL_FRAG_LEN;
int ret = 0;
int i;
+ int j;
struct sk_buff *skb;
struct hci_rp_read_local_version *rp;
@@ -401,7 +402,12 @@ 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)
+ j = (i & 0x7f) + 1;
+ else
+ j = i;
+
+ dl_cmd->index = j;
if (i == (frag_num - 1)) {
dl_cmd->index |= 0x80; /* data end */
frag_len = fw_len % RTL_FRAG_LEN;
--
2.17.1
Powered by blists - more mailing lists