From: Chris Lu Date: Tue, 3 Feb 2026 06:25:08 +0000 (+0800) Subject: Bluetooth: btmtk: improve mt79xx firmware setup retry flow X-Git-Tag: v7.1-rc1~173^2~12^2~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54f1f020e9f4a087779cc4d96a7c86f47d0c6797;p=thirdparty%2Fkernel%2Flinux.git Bluetooth: btmtk: improve mt79xx firmware setup retry flow 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 Signed-off-by: Luiz Augusto von Dentz --- diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c index fa7533578f85c..0ada5a12130dc 100644 --- a/drivers/bluetooth/btmtk.c +++ b/drivers/bluetooth/btmtk.c @@ -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;