diff mbox series

[1/2,SRU,OEM-5.13/OEM-5.14/Impish] UBUNTU: SAUCE: Bluetooth: btusb: Handle download_firmware failure cases

Message ID 20211213093910.3521363-2-vicamo.yang@canonical.com
State New
Headers show
Series Fix MT7921 failed to start WM firmware | expand

Commit Message

You-Sheng Yang Dec. 13, 2021, 9:39 a.m. UTC
From: Mark Chen <mark-yw.chen@mediatek.com>

BugLink: https://bugs.launchpad.net/bugs/1954300

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")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Mark Chen <mark-yw.chen@mediatek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
(backported from
https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=00c0ee9850b7b0cb7c40b8daba806ae2245e59d4)
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
 drivers/bluetooth/btusb.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Tim Gardner Dec. 13, 2021, 3:24 p.m. UTC | #1
Acked-by: Tim Gardner <tim.gardner@canonical.com>

This can now be cherry-picked from commit 
00c0ee9850b7b0cb7c40b8daba806ae2245e59d4 linux-next

rtg

On 12/13/21 2:39 AM, You-Sheng Yang wrote:
> From: Mark Chen <mark-yw.chen@mediatek.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1954300
> 
> 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")
> Co-developed-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Mark Chen <mark-yw.chen@mediatek.com>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> (backported from
> https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=00c0ee9850b7b0cb7c40b8daba806ae2245e59d4)
> Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
> ---
>   drivers/bluetooth/btusb.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 70754138ebff..96b2401106d5 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3792,6 +3792,10 @@ static int btusb_mtk_setup(struct hci_dev *hdev)
>   			"mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
>   			 dev_id & 0xffff, (fw_version & 0xff) + 1);
>   		err = btusb_mtk_setup_firmware_79xx(hdev, fw_bin_name);
> +		if (err < 0) {
> +			bt_dev_err(hdev, "Failed to set up firmware (%d)", err);
> +			return err;
> +		}
>   
>   		/* Enable Bluetooth protocol */
>   		param = 1;
>
diff mbox series

Patch

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 70754138ebff..96b2401106d5 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3792,6 +3792,10 @@  static int btusb_mtk_setup(struct hci_dev *hdev)
 			"mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
 			 dev_id & 0xffff, (fw_version & 0xff) + 1);
 		err = btusb_mtk_setup_firmware_79xx(hdev, fw_bin_name);
+		if (err < 0) {
+			bt_dev_err(hdev, "Failed to set up firmware (%d)", err);
+			return err;
+		}
 
 		/* Enable Bluetooth protocol */
 		param = 1;