Skip to content

Commit b61b388

Browse files
author
Jinwang Li
committed
FROMLIST: driver: 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 cleanup onsetup failure, and reopen the port only when retrying. Fixes: 9e80587 ("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> Link: https://lore.kernel.org/all/20260205062600.590342-1-jinwang.li@oss.qualcomm.com/ CRs-Fixed: 4378012
1 parent 0cf570b commit b61b388

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

drivers/bluetooth/hci_qca.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,19 +2030,23 @@ static int qca_setup(struct hci_uart *hu)
20302030
}
20312031

20322032
out:
2033-
if (ret && retries < MAX_INIT_RETRIES) {
2034-
bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
2033+
if (ret) {
20352034
qca_power_shutdown(hu);
2036-
if (hu->serdev) {
2037-
serdev_device_close(hu->serdev);
2038-
ret = serdev_device_open(hu->serdev);
2039-
if (ret) {
2040-
bt_dev_err(hdev, "failed to open port");
2041-
return ret;
2035+
2036+
if (retries < MAX_INIT_RETRIES) {
2037+
bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
2038+
if (hu->serdev) {
2039+
serdev_device_close(hu->serdev);
2040+
ret = serdev_device_open(hu->serdev);
2041+
if (ret) {
2042+
bt_dev_err(hdev, "failed to open port");
2043+
return ret;
2044+
}
20422045
}
2046+
retries++;
2047+
goto retry;
20432048
}
2044-
retries++;
2045-
goto retry;
2049+
return ret;
20462050
}
20472051

20482052
/* Setup bdaddr */

0 commit comments

Comments
 (0)