[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260105141427.196411-2-jinwang.li@oss.qualcomm.com>
Date: Mon, 5 Jan 2026 22:14:27 +0800
From: Jinwang Li <jinwang.li@....qualcomm.com>
To: Bartosz Golaszewski <brgl@...ev.pl>, Marcel Holtmann <marcel@...tmann.org>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>
Cc: linux-arm-msm@...r.kernel.org, linux-bluetooth@...r.kernel.org,
linux-kernel@...r.kernel.org, cheng.jiang@....qualcomm.com,
quic_chezhou@...cinc.com, wei.deng@....qualcomm.com,
shuai.zhang@....qualcomm.com, mengshi.wu@....qualcomm.com,
jinwang.li@....qualcomm.com
Subject: [PATCH v3 1/1] Bluetooth: hci_qca: Cleanup on all setup failures
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.
Signed-off-by: Jinwang Li <jinwang.li@....qualcomm.com>
---
drivers/bluetooth/hci_qca.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index a3c217571..4a69e66f6 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2045,19 +2045,24 @@ 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) {
+ 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) {
+ 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
Powered by blists - more mailing lists