]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Bluetooth: btmtk: improve mt79xx firmware setup retry flow
authorChris Lu <chris.lu@mediatek.com>
Tue, 3 Feb 2026 06:25:08 +0000 (14:25 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 10 Apr 2026 14:20:39 +0000 (10:20 -0400)
If retries are exhausted, driver should not do futher operation.
During mt79xx firmware download process, if the retry count reaches0,
driver will return an -EIO error and release the firmware resources.

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

index fa7533578f85c9cfe2c6f25c4a023d7265fd4198..0ada5a12130dc2190f4c5ab02846e7667357d8d4 100644 (file)
@@ -205,6 +205,12 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
                                }
                        }
 
+                       /* If retry exhausted goto err_release_fw */
+                       if (retry == 0) {
+                               err = -EIO;
+                               goto err_release_fw;
+                       }
+
                        fw_ptr += section_offset;
                        wmt_params.op = BTMTK_WMT_PATCH_DWNLD;
                        wmt_params.status = NULL;