[PATCH v1] FROMLIST: driver: bluetooth: hci_qca: Always perform cleanup on every setup failure

jinwli posted 1 patch 1 month, 2 weeks ago
drivers/bluetooth/hci_qca.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
[PATCH v1] FROMLIST: driver: bluetooth: hci_qca: Always perform cleanup on every setup failure
Posted by jinwli 1 month, 2 weeks ago
The retry logic in qca_setup combined error handling and
retry gating under a single condition. This caused the final failed
attempt (when retries reached MAX_INIT_RETRIES) to return without
performing cleanup.

So only jumping to retry when there is a error and retries have not
reached MAX_INIT_RETRIES.

Signed-off-by: jinwli <jinwang.li@oss.qualcomm.com>
---
 drivers/bluetooth/hci_qca.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 1d3b62579..b695577f8 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2026,7 +2026,7 @@ static int qca_setup(struct hci_uart *hu)
 	}
 
 out:
-	if (ret && retries < MAX_INIT_RETRIES) {
+	if (ret) {
 		bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
 		qca_power_shutdown(hu);
 		if (hu->serdev) {
@@ -2037,8 +2037,10 @@ static int qca_setup(struct hci_uart *hu)
 				return ret;
 			}
 		}
-		retries++;
-		goto retry;
+		if (retries < MAX_INIT_RETRIES) {
+			retries++;
+			goto retry;
+		}
 	}
 
 	/* Setup bdaddr */
-- 
2.34.1
Re: [PATCH v1] FROMLIST: driver: bluetooth: hci_qca: Always perform cleanup on every setup failure
Posted by Konrad Dybcio 1 month, 1 week ago
On 12/22/25 1:38 PM, jinwli wrote:
> The retry logic in qca_setup combined error handling and
> retry gating under a single condition. This caused the final failed
> attempt (when retries reached MAX_INIT_RETRIES) to return without
> performing cleanup.
> 
> So only jumping to retry when there is a error and retries have not
> reached MAX_INIT_RETRIES.
> 
> Signed-off-by: jinwli <jinwang.li@oss.qualcomm.com>

Please fix your git name (unless that is how you actually write your name)

Why the 'FROMLIST:' in the title? It seems like you're the first submitter:

https://lore.kernel.org/all/?q=Always+perform+cleanup+on+every+setup+failure

Konrad