Skip to contentSkip to conversation

Bluetooth: hci_qca: Cleanup on all setup failures

PATCH Superseded Jinwang Li 3 participants 3 messages Jan 6

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Jinwang Li

author
#0 lore raw

PATCH v4 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.

Fixes 9e80587aba4c ("Bluetooth: hci_qca: Enhance retry logic in qca_setup")

---
V3 -> V4:
- Add 'Fixes:' tag.
- Link to v3
https://lore.kernel.org/all/[email protected]/

V2 -> V3:
- Update git name.
- Link to v2
https://lore.kernel.org/all/[email protected]/

V1 -> V2:
- Only reopen the serdev port when retrying.
- Return on the final failure.
- Update commit.
- Link to v1
https://lore.kernel.org/all/[email protected]/

 drivers/bluetooth/hci_qca.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/bluetooth/hci_qca.c +14 -9
index b54350317a43..8414fa75e540 100644
@@ -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 */
Signature · 1 line
2.34.1
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1038894

---Test result---

Test Summary:

CheckPatch                    PENDING   0.41 seconds
GitLint                       PENDING   0.34 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      23.56 seconds
CheckAllWarning               PASS      25.96 seconds
CheckSparse                   PASS      29.20 seconds
BuildKernel32                 PASS      23.95 seconds
TestRunnerSetup               PASS      514.15 seconds
TestRunner_l2cap-tester       PASS      28.44 seconds
TestRunner_iso-tester         PASS      77.34 seconds
TestRunner_bnep-tester        PASS      7.71 seconds
TestRunner_mgmt-tester        FAIL      135.25 seconds
TestRunner_rfcomm-tester      PASS      9.76 seconds
TestRunner_sco-tester         FAIL      14.68 seconds
TestRunner_ioctl-tester       PASS      10.28 seconds
TestRunner_mesh-tester        FAIL      11.42 seconds
TestRunner_smp-tester         PASS      8.60 seconds
TestRunner_userchan-tester    PASS      6.60 seconds
IncrementalBuild              PENDING   0.42 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
Read Exp Feature - Success Failed 0.104 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected

BUG: sleeping function called from invalid context at net/core/sock.c:3782

Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases

Mesh - Send cancel - 1                               Timed out    1.844 seconds
Mesh - Send cancel - 2                               Timed out    1.997 seconds

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

maintainer Reviewed-by on v4 1/1
#2 lore raw
In reply to Jinwang Li
Quoted 10 lines · Jinwang Li

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")

---