Skip to contentSkip to conversation

Bluetooth: btusb: Handle download_firmware failure cases

PATCH In review [email protected] 2 participants 4 messages Dec 6, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 Bluetooth: btusb: Handle download_firmware failure cases

From: Mark Chen <[email protected]>

For Mediatek chipset, it can not enabled if there are something wrong in btmtk_setup_firmware_79xx(). Thus, the process must be terminated and returned error code.

Fixes fc342c4dc4087 ("Bluetooth: btusb: Add protocol support for MediaTek MT7921U USB devices")
---
 drivers/bluetooth/btusb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/bluetooth/btusb.c +4 -0
index ab169fc673ea..923cfbe40dae 100644
@@ -2554,6 +2554,10 @@ static int btusb_mtk_setup(struct hci_dev *hdev)
 			 dev_id & 0xffff, (fw_version & 0xff) + 1);
 		err = btmtk_setup_firmware_79xx(hdev, fw_bin_name,
 						btusb_mtk_hci_wmt_sync);
+		if (err < 0) {
+			bt_dev_err(hdev, "Failed to set up firmware (%d)", err);
+			return err;
+		}
 
 		/* It's Device EndPoint Reset Option Register */
 		btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, MTK_EP_RST_IN_OUT_OPT);
Signature · 1 line
2.18.0
#1 lore raw

PATCH v3 2/2 Bluetooth: btusb: Return error code when getting patch status failed

From: Mark Chen <[email protected]>

If there are failure cases in getting patch status, it should return the error code (-EIO).

Fixes fc342c4dc4087 ("Bluetooth: btusb: Add protocol support for MediaTek MT7921U USB devices")
---
 drivers/bluetooth/btmtk.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bluetooth/btmtk.c +1 -0
index c2ee5c4b975a..526dfdf1fe01 100644
@@ -121,6 +121,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
 				} else {
 					bt_dev_err(hdev, "Failed wmt patch dwnld status (%d)",
 						   status);
+					err = -EIO;
 					goto err_release_fw;
 				}
 			}
Signature · 1 line
2.18.0
maintainer
#2 lore raw

Re: [PATCH v3 2/2] Bluetooth: btusb: Return error code when getting patch status failed

Hi Mark,

Quoted 10 lines

If there are failure cases in getting patch status, it should return the error code (-EIO).

Fixes fc342c4dc4087 ("Bluetooth: btusb: Add protocol support for MediaTek MT7921U USB devices")

---
drivers/bluetooth/btmtk.c | 1 +

1 file changed, 1 insertion(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel

maintainer
#3 lore raw
In reply to [email protected]

Hi Mark,

Quoted 11 lines

For Mediatek chipset, it can not enabled if there are something wrong in btmtk_setup_firmware_79xx(). Thus, the process must be terminated and returned error code.

Fixes fc342c4dc4087 ("Bluetooth: btusb: Add protocol support for MediaTek MT7921U USB devices")

---
drivers/bluetooth/btusb.c | 4 ++++

1 file changed, 4 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel