Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH v5] Bluetooth: hci_qca: Cleanup on all setup failures
@ 2026-02-05  6:26 Jinwang Li
  2026-02-11 19:40 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Jinwang Li @ 2026-02-05  6:26 UTC (permalink / raw)
  To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz,
	Abhishek Pandit-Subedi, Balakrishna Godavarthi
  Cc: linux-arm-msm, linux-bluetooth, linux-kernel, cheng.jiang,
	quic_chezhou, wei.deng, shuai.zhang, mengshi.wu, jinwang.li,
	bartosz.golaszewski

The setup process previously combined error handling and retry gating
under one condition. As a result, the final failed attempt exited
without performing cleanup.

Update the failure path to always perform power and port cleanup on
setup failure, and reopen the port only when retrying.

Fixes: 9e80587aba4c ("Bluetooth: hci_qca: Enhance retry logic in qca_setup")
Signed-off-by: Jinwang Li <jinwang.li@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
V4 -> V5: 
- Close and reopen the serdev only on retry attempts.
- When the open fails, hci_dev_open_sync() will run its cleanup path.
- Link to v4
  https://lore.kernel.org/all/20260106094310.784564-1-jinwang.li@oss.qualcomm.com/

V3 -> V4: 
- Add 'Fixes:' tag.
- Link to v3
  https://lore.kernel.org/all/20260105141427.196411-1-jinwang.li@oss.qualcomm.com/

V2 -> V3:
- Update git name.
- Link to v2
  https://lore.kernel.org/all/20251226102707.3449789-1-jinwang.li@oss.qualcomm.com/

V1 -> V2:
- Only reopen the serdev port when retrying.
- Return on the final failure.
- Update commit.
- Link to v1
  https://lore.kernel.org/all/20251222123824.3000167-1-jinwang.li@oss.qualcomm.com/
 drivers/bluetooth/hci_qca.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index b54350317a43..ab6bfc1d7197 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2045,19 +2045,23 @@ static int qca_setup(struct hci_uart *hu)
 	}
 
 out:
-	if (ret && retries < MAX_INIT_RETRIES) {
-		bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
+	if (ret) {
 		qca_power_shutdown(hu);
-		if (hu->serdev) {
-			serdev_device_close(hu->serdev);
-			ret = serdev_device_open(hu->serdev);
-			if (ret) {
-				bt_dev_err(hdev, "failed to open port");
-				return ret;
+
+		if (retries < MAX_INIT_RETRIES) {
+			bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
+			if (hu->serdev) {
+				serdev_device_close(hu->serdev);
+				ret = serdev_device_open(hu->serdev);
+				if (ret) {
+					bt_dev_err(hdev, "failed to open port");
+					return ret;
+				}
 			}
+			retries++;
+			goto retry;
 		}
-		retries++;
-		goto retry;
+		return ret;
 	}
 
 	/* Setup bdaddr */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v5] Bluetooth: hci_qca: Cleanup on all setup failures
  2026-02-05  6:26 [PATCH v5] Bluetooth: hci_qca: Cleanup on all setup failures Jinwang Li
@ 2026-02-11 19:40 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2026-02-11 19:40 UTC (permalink / raw)
  To: Jinwang Li
  Cc: brgl, marcel, luiz.dentz, abhishekpandit, quic_bgodavar,
	linux-arm-msm, linux-bluetooth, linux-kernel, cheng.jiang,
	quic_chezhou, wei.deng, shuai.zhang, mengshi.wu,
	bartosz.golaszewski

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu,  5 Feb 2026 14:26:00 +0800 you wrote:
> The setup process previously combined error handling and retry gating
> under one condition. As a result, the final failed attempt exited
> without performing cleanup.
> 
> Update the failure path to always perform power and port cleanup on
> setup failure, and reopen the port only when retrying.
> 
> [...]

Here is the summary with links:
  - [v5] Bluetooth: hci_qca: Cleanup on all setup failures
    https://git.kernel.org/bluetooth/bluetooth-next/c/f266be5c8533

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-11 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05  6:26 [PATCH v5] Bluetooth: hci_qca: Cleanup on all setup failures Jinwang Li
2026-02-11 19:40 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox