linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases
@ 2021-12-06 17:33 mark-yw.chen
  2021-12-06 17:33 ` [PATCH v3 2/2] Bluetooth: btusb: Return error code when getting patch status failed mark-yw.chen
  2021-12-06 19:40 ` [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: mark-yw.chen @ 2021-12-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: sean.wang, mark-yw.chen, aaron.hou, kaichuan.hsieh, pmenzel,
	linux-bluetooth, linux-mediatek, linux-kernel

From: Mark Chen <mark-yw.chen@mediatek.com>

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>
---
 drivers/bluetooth/btusb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ab169fc673ea..923cfbe40dae 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -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);
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] Bluetooth: btusb: Return error code when getting patch status failed
  2021-12-06 17:33 [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases mark-yw.chen
@ 2021-12-06 17:33 ` mark-yw.chen
  2021-12-06 19:40   ` Marcel Holtmann
  2021-12-06 19:40 ` [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: mark-yw.chen @ 2021-12-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: sean.wang, mark-yw.chen, aaron.hou, kaichuan.hsieh, pmenzel,
	linux-bluetooth, linux-mediatek, linux-kernel

From: Mark Chen <mark-yw.chen@mediatek.com>

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")
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>
---
 drivers/bluetooth/btmtk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index c2ee5c4b975a..526dfdf1fe01 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -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;
 				}
 			}
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases
  2021-12-06 17:33 [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases mark-yw.chen
  2021-12-06 17:33 ` [PATCH v3 2/2] Bluetooth: btusb: Return error code when getting patch status failed mark-yw.chen
@ 2021-12-06 19:40 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2021-12-06 19:40 UTC (permalink / raw)
  To: mark-yw.chen
  Cc: Johan Hedberg, Sean Wang, aaron.hou, kaichuan.hsieh, Paul Menzel,
	linux-bluetooth, linux-mediatek, linux-kernel

Hi Mark,

> 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>
> ---
> drivers/bluetooth/btusb.c | 4 ++++
> 1 file changed, 4 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 2/2] Bluetooth: btusb: Return error code when getting patch status failed
  2021-12-06 17:33 ` [PATCH v3 2/2] Bluetooth: btusb: Return error code when getting patch status failed mark-yw.chen
@ 2021-12-06 19:40   ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2021-12-06 19:40 UTC (permalink / raw)
  To: mark-yw.chen
  Cc: Johan Hedberg, sean.wang, aaron.hou, kaichuan.hsieh, pmenzel,
	linux-bluetooth, linux-mediatek, linux-kernel

Hi Mark,

> 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")
> 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>
> ---
> drivers/bluetooth/btmtk.c | 1 +
> 1 file changed, 1 insertion(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-06 19:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 17:33 [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases mark-yw.chen
2021-12-06 17:33 ` [PATCH v3 2/2] Bluetooth: btusb: Return error code when getting patch status failed mark-yw.chen
2021-12-06 19:40   ` Marcel Holtmann
2021-12-06 19:40 ` [PATCH v3 1/2] Bluetooth: btusb: Handle download_firmware failure cases Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).