Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D593DC433F5 for ; Mon, 6 Dec 2021 09:25:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240683AbhLFJ31 (ORCPT ); Mon, 6 Dec 2021 04:29:27 -0500 Received: from mailgw01.mediatek.com ([60.244.123.138]:44262 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S240600AbhLFJ3X (ORCPT ); Mon, 6 Dec 2021 04:29:23 -0500 X-UUID: 345462dc4d974bffab457c69e00633ea-20211206 X-UUID: 345462dc4d974bffab457c69e00633ea-20211206 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1631942379; Mon, 06 Dec 2021 17:25:53 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 6 Dec 2021 17:25:51 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 6 Dec 2021 17:25:51 +0800 From: To: , CC: , , , , , Subject: [PATCH] Bluetooth: btusb: Handle download_firmware failure cases. Date: Mon, 6 Dec 2021 17:25:46 +0800 Message-ID: <20211206092546.27216-1-mark-yw.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: mark-yw.chen For Mediatek chipset, if there are no firmware bin or command_timeout, the process should be terminated in btusb_mtk_setup(). Signed-off-by: mark-yw.chen Change-Id: I99f1d7b72fa70643d9123e7e6cdc8d0b4369ce52 --- drivers/bluetooth/btmtk.c | 1 + drivers/bluetooth/btusb.c | 4 ++++ 2 files changed, 5 insertions(+) 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; } } diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index ab169fc673ea..3ea04b1d0750 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 setup 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