Linux bluetooth development
 help / color / mirror / Atom feed
From: Ameen Al-Asady <ameenaladdin@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Ameen Al-Asady <ameenaladdin@gmail.com>
Subject: [PATCH 1/2] Bluetooth: btintel: Fix spurious error on FW download error recovery
Date: Mon, 13 Jul 2026 17:55:36 -0400	[thread overview]
Message-ID: <20260713215537.81222-1-ameenaladdin@gmail.com> (raw)

When firmware download fails because the controller is running an
operational image whose version does not match the firmware file on
disk (the normal case for a firmware upgrade across a warm reboot,
since the operational image survives in controller RAM),
btintel_reset_to_bootloader() sends the Intel Reset vendor command to
force the controller back into bootloader mode for the download retry.

The controller acts on Intel Reset by resetting and re-enumerating on
the bus, which can happen before the command complete event is
delivered. In that case __hci_cmd_sync() fails with -ENODEV and the
driver logs a misleading error even though recovery is proceeding
exactly as intended:

  Bluetooth: hci0: Found device firmware: intel/ibt-0041-0041.sfi
  Bluetooth: hci0: Boot Address: 0x100800
  Bluetooth: hci0: Firmware Version: 202-5.26
  usb 1-6: USB disconnect, device number 4
  Bluetooth: hci0: FW download error recovery failed (-19)
  usb 1-6: new full-speed USB device number 5 using xhci_hcd
  ...
  Bluetooth: hci0: Firmware loaded in 2827613 usecs

Treat -ENODEV as the expected outcome of the reset rather than a
recovery failure, and keep the error message for genuine failures.

Signed-off-by: Ameen Al-Asady <ameenaladdin@gmail.com>
---
 drivers/bluetooth/btintel.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 5e9cac090..472542bff 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -1363,12 +1363,22 @@ static void btintel_reset_to_bootloader(struct hci_dev *hdev)
 	skb = __hci_cmd_sync(hdev, BTINTEL_HCI_OP_RESET, sizeof(params),
 			     &params, HCI_INIT_TIMEOUT);
 	if (IS_ERR(skb)) {
-		bt_dev_err(hdev, "FW download error recovery failed (%ld)",
-			   PTR_ERR(skb));
-		return;
+		/* The controller acts on Intel Reset by resetting and
+		 * re-enumerating on the bus, which can happen before the
+		 * command complete event is delivered. The resulting
+		 * -ENODEV means the reset took effect, not that recovery
+		 * failed.
+		 */
+		if (PTR_ERR(skb) != -ENODEV) {
+			bt_dev_err(hdev,
+				   "FW download error recovery failed (%ld)",
+				   PTR_ERR(skb));
+			return;
+		}
+	} else {
+		kfree_skb(skb);
 	}
 	bt_dev_info(hdev, "Intel reset sent to retry FW download");
-	kfree_skb(skb);
 
 	/* Current Intel BT controllers(ThP/JfP) hold the USB reset
 	 * lines for 2ms when it receives Intel Reset in bootloader mode.

base-commit: eab19cb7618e5c50fd1f8c1efdc4e66e16575975
-- 
2.55.0


             reply	other threads:[~2026-07-13 21:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 21:55 Ameen Al-Asady [this message]
2026-07-13 21:55 ` [PATCH 2/2] Bluetooth: hci_sync: Skip MSFT/AOSP init when controller init failed Ameen Al-Asady
2026-07-13 22:50 ` [1/2] Bluetooth: btintel: Fix spurious error on FW download error recovery bluez.test.bot
2026-07-14  0:00 ` [PATCH 1/2] " Paul Menzel
2026-07-14  3:09   ` Ameen Al-Asady

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=20260713215537.81222-1-ameenaladdin@gmail.com \
    --to=ameenaladdin@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /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