Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: btmtk: add status check in mt79xx firmware setup

To prevent abnormal controller states, it is necessary to check
status in another part of the mt79xx firmware setup. During this
process, receiving the 'BTMTK_WMT_PATCH_PROGRESS' status is unexpected.
If this occurs, it should be treated as an error, and driver must be
prevented from continuing execution.

Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Chris Lu and committed by
Luiz Augusto von Dentz
b27a306e 54f1f020

+8 -2
+8 -2
drivers/bluetooth/btmtk.c
··· 213 213 214 214 fw_ptr += section_offset; 215 215 wmt_params.op = BTMTK_WMT_PATCH_DWNLD; 216 - wmt_params.status = NULL; 217 216 218 217 while (dl_size > 0) { 219 218 dlen = min_t(int, 250, dl_size); ··· 230 231 wmt_params.data = fw_ptr; 231 232 232 233 err = wmt_cmd_sync(hdev, &wmt_params); 233 - if (err < 0) { 234 + /* Status BTMTK_WMT_PATCH_PROGRESS indicates firmware is 235 + * in process of being downloaded, which is not expected to 236 + * occur here. 237 + */ 238 + if (status == BTMTK_WMT_PATCH_PROGRESS) { 239 + err = -EIO; 240 + goto err_release_fw; 241 + } else if (err < 0) { 234 242 bt_dev_err(hdev, "Failed to send wmt patch dwnld (%d)", 235 243 err); 236 244 goto err_release_fw;