Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3981899pxb; Tue, 25 Jan 2022 00:36:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtU5NAxYY4KG5Bu2bUTPNo4pg2pQWl26WYSJvV6CccGJFV3Dch3QbMHg4Nmkf6rvOU3Z78 X-Received: by 2002:a05:6402:2985:: with SMTP id eq5mr19585302edb.104.1643099788922; Tue, 25 Jan 2022 00:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099788; cv=none; d=google.com; s=arc-20160816; b=GfPbP1LM3OeIZBQNNVDUIR2i/rBdeDMb/1pqtm2rdNMbpPqjdpV0yNkzg7xPc3zs4z CzeyiQv1Tq9c1PJusqxPxEqsdLwtreXloBZKqKnYwOPnkeEjlh+dbJ9jTyjncO/T0G1V AhGCrP4nrElce3FI2jmmS+E7KPJvrcavtnK6dMq0whlMawPThNxzxP9L/v5txEaG3jy9 4aNzkCJtX5qteZrhr3zH8EHniCao/vBNSwNdvSq2o4fYNNAEPIUpuQkYNDTeerniBqtW tdlJbjo4gdnWsPfW/Mqr58XmfC0MRV8a4U0Wlq5t4OeUlzgOKjRULYEimkro6IVLrmiH IEpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f7R+k3JJb7MieFeEUvM7ZJ6ruhCYaq/MV4rB+nVwuVo=; b=QgrVajzHD3VaTTRlleFICX3olmUL3iaXyq6X6N+RvOgVZIILiM+g4J+fSRoyzbuisn dKMaNtIwrzf6nAQEtf5Y5kG8Yp0R2XDKTLsudmIjy+DNR1WaUfrJsN38+39/wuK94TLs OxMXPTz6gEhU4xCWZsP9XET2KFqmGAZWXTsVvxZHHET6kPj3WiS4BbfOrgUE5HXeT65N kjOrr6Scc9Jnt9FrJwOya9ny9ncy1LQFNNZ/dB9KaM0RPbqnu1ncTL7g5h2zkH5Trpen 2BCtJ752SAyE6lEIQTAV4E98nSyaFydm7iLyIvOSr13zHrNX3hC+RFpeMGw9shpR3RD0 nuVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=StSvJKeU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sc10si8270544ejc.290.2022.01.25.00.36.04; Tue, 25 Jan 2022 00:36:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=StSvJKeU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1314957AbiAYCwH (ORCPT + 99 others); Mon, 24 Jan 2022 21:52:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58382 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354126AbiAXVFp (ORCPT ); Mon, 24 Jan 2022 16:05:45 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61A3A6141C; Mon, 24 Jan 2022 21:05:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3973CC340EC; Mon, 24 Jan 2022 21:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058342; bh=jP+0gXL/VNQriQLXfi4a6uJjR2ZLUnqmaq2pjhalBUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StSvJKeUtlFUGgsxEo68zVwQ5kFHqKJ6jSGXkhSNusqH8yPw4McARO7ENYtXYRiav j4B3FNr5LVtgu+uSyrjWxHvHPXX1rULpcOM32jPLsHhGW1/PZCfX0RgvddqNmlh6Uh wZiAPP93cJxbyeAYPZTHr7piQrYrzyrARd7PLtPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Mark Chen , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0257/1039] Bluetooth: btusb: Handle download_firmware failure cases Date: Mon, 24 Jan 2022 19:34:06 +0100 Message-Id: <20220124184133.952496250@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Chen [ Upstream commit 00c0ee9850b7b0cb7c40b8daba806ae2245e59d4 ] 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 Signed-off-by: Sean Wang Signed-off-by: Mark Chen Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c923c38658baa..a766660603634 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2895,6 +2895,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; + } /* It's Device EndPoint Reset Option Register */ btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, MTK_EP_RST_IN_OUT_OPT); -- 2.34.1