linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Max Chou <max.chou@realtek.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	linux-kernel@vger.kernel.org, alex_lu@realsil.com.cn
Subject: Re: [PATCH] Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over 32K bytes
Date: Wed, 4 Sep 2019 16:01:26 +0200	[thread overview]
Message-ID: <4BACAECC-C4CF-4EB7-8626-E628934DAE32@holtmann.org> (raw)
In-Reply-To: <20190902090809.3409-1-max.chou@realtek.com>

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 <max.chou@realtek.com>
> ---
> 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


  reply	other threads:[~2019-09-04 14:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02  9:08 [PATCH] Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over 32K bytes max.chou
2019-09-04 14:01 ` Marcel Holtmann [this message]
2019-09-05  3:49 max.chou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BACAECC-C4CF-4EB7-8626-E628934DAE32@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=alex_lu@realsil.com.cn \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.chou@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).