Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over 32K bytes
PATCH v2 1/1 Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over 32K bytes
From: Max Chou <[email protected]>
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.
---
Changes in v2:
- Added the comment for commit message
- Remove the extra variable
drivers/bluetooth/btrtl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +5 -1
@@ -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 ;
Signature · 1 line
2.17.1
Marcel Holtmann
maintainerHi Max,
Quoted 7 lines
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.
Quoted 8 lines
Signed-off-by Max Chou <[email protected]>---
Changes in v2:
- Added the comment for commit message
- Remove the extra variable
drivers/bluetooth/btrtl.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel