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