Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp734442ybe; Wed, 4 Sep 2019 07:02:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuv5qSn2JGKMZSnJS7gxU1RES9or6x7wu/Z1DgHz73abgKpSVPtVL6Fz2TCARP1dFQjKFK X-Received: by 2002:a17:90a:18e:: with SMTP id 14mr5076483pjc.66.1567605768075; Wed, 04 Sep 2019 07:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567605768; cv=none; d=google.com; s=arc-20160816; b=xZ6RU2n2lkUtxPqlp/T70ikNFOoVxVlOY6i4ChI7KqbQoU/k1PQQhB50Mm2PvK7d34 e0+fHNkJbTztdSl6TYn5A7AMFBDVmwlU2t3v/TaevoYpo0zIvTixguDZfHrm6r87M8me sz6+MBjj7uE2dUNF7OGtc1IlzPdbWvmj0YkmMkPYrL3EgMsDPm5IYB2KsbMMp5gPmosC M7fkHpZgS4af71NYeysb9O3wb4BLySx6S+cE6aCuYKB63AR8jaBs3qdr26gnYArqE2tn DY+0YcpCfjZO8l6B3T5/xtXEoxK39px0TZ0VGQwIXCdduvHmoyi5EmrkOdtypDHQ3eeL 3hiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=tQTDP4M7FSgjtJW4dF0jckuGXfThdpeg+SKAU3f+F0E=; b=gG/lkumpHh3T0qLRcZ6baElPi8mzz5yUJ7M9UPqNbvi+//hV9H9e8fjxfklNl+9I24 LIS1N2xutGUXAfwq/btvi3U35NtMwYpHMaetuBS9xLdpBuIuPMtSe9+xBbG7mUtslAZm YzmbJ4dj16Z5pOsD/OsveEjnfwjdLpJti+VU4QTTTIrxQJnOUwXegZ2NZHeAtAySFV6R MBraNmMK0B9CLiwqVe7oWBVqENcpO37bTkiAOk33J8+0kDYKzFLjXb6COHyQ8c2iXhI/ ULdMnwspMwjb8dZqeZ4FGnCYHqt2lLagx99w08taCfTStdX2OeskFM/ByIda1IirLVwo JPEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si17122179pgu.48.2019.09.04.07.02.15; Wed, 04 Sep 2019 07:02:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731169AbfIDOBa convert rfc822-to-8bit (ORCPT + 99 others); Wed, 4 Sep 2019 10:01:30 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:57388 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731161AbfIDOB3 (ORCPT ); Wed, 4 Sep 2019 10:01:29 -0400 Received: from marcel-macbook.fritz.box (p4FEFC197.dip0.t-ipconnect.de [79.239.193.151]) by mail.holtmann.org (Postfix) with ESMTPSA id C7B46CECA3; Wed, 4 Sep 2019 16:10:14 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH] Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over 32K bytes From: Marcel Holtmann In-Reply-To: <20190902090809.3409-1-max.chou@realtek.com> Date: Wed, 4 Sep 2019 16:01:26 +0200 Cc: Johan Hedberg , linux-bluetooth , linux-kernel@vger.kernel.org, alex_lu@realsil.com.cn Content-Transfer-Encoding: 8BIT Message-Id: <4BACAECC-C4CF-4EB7-8626-E628934DAE32@holtmann.org> References: <20190902090809.3409-1-max.chou@realtek.com> To: Max Chou X-Mailer: Apple Mail (2.3445.104.11) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Max, > Fix the issue that when the FW size is 32K+, it will fail for the download > process because of the incorrect index. > > Signed-off-by: Max Chou > --- > drivers/bluetooth/btrtl.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c > index 0354e93e7a7c..215896af0259 100644 > --- a/drivers/bluetooth/btrtl.c > +++ b/drivers/bluetooth/btrtl.c > @@ -389,6 +389,7 @@ static int rtl_download_firmware(struct hci_dev *hdev, > int frag_len = RTL_FRAG_LEN; > int ret = 0; > int i; > + int j; > struct sk_buff *skb; > struct hci_rp_read_local_version *rp; > > @@ -401,7 +402,12 @@ static int rtl_download_firmware(struct hci_dev *hdev, > > BT_DBG("download fw (%d/%d)", i, frag_num); > > - dl_cmd->index = i; > + if (i > 0x7f) > + j = (i & 0x7f) + 1; > + else > + j = i; > + > + dl_cmd->index = j; so this seems rather complicated with the extra variable. if (i > 0x7f) dl_cmd->index = (i & 0x7f) + 1; else dl_cmd->index = i; And I would prefer to have a small comment above on why this is done this way. Regards Marcel