[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260203062510.848761-3-chris.lu@mediatek.com>
Date: Tue, 3 Feb 2026 14:25:09 +0800
From: Chris Lu <chris.lu@...iatek.com>
To: Marcel Holtmann <marcel@...tmann.org>, Johan Hedberg
<johan.hedberg@...il.com>, Luiz Von Dentz <luiz.dentz@...il.com>
CC: Sean Wang <sean.wang@...iatek.com>, Will Lee <will-cy.Lee@...iatek.com>,
SS Wu <ss.wu@...iatek.com>, Steve Lee <steve.lee@...iatek.com>,
linux-bluetooth <linux-bluetooth@...r.kernel.org>, linux-kernel
<linux-kernel@...r.kernel.org>, linux-mediatek
<linux-mediatek@...ts.infradead.org>, Chris Lu <chris.lu@...iatek.com>
Subject: [PATCH v1 2/3] 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@...iatek.com>
---
drivers/bluetooth/btmtk.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index b0f87b04046e..67db5a48c3e4 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -213,7 +213,6 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
fw_ptr += section_offset;
wmt_params.op = BTMTK_WMT_PATCH_DWNLD;
- wmt_params.status = NULL;
while (dl_size > 0) {
dlen = min_t(int, 250, dl_size);
@@ -231,7 +230,14 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
wmt_params.data = fw_ptr;
err = wmt_cmd_sync(hdev, &wmt_params);
- if (err < 0) {
+ /* Status BTMTK_WMT_PATCH_PROGRESS indicates firmware is
+ * in process of being downloaded, which is not expected to
+ * occur here.
+ */
+ if (status == BTMTK_WMT_PATCH_PROGRESS) {
+ err = -EIO;
+ goto err_release_fw;
+ } else if (err < 0) {
bt_dev_err(hdev, "Failed to send wmt patch dwnld (%d)",
err);
goto err_release_fw;
--
2.45.2
Powered by blists - more mailing lists