Skip to content

Commit 5c4e9a8

Browse files
Jinwang LiVudentz
authored andcommitted
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: 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> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent 21e4271 commit 5c4e9a8

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
@@ -2046,19 +2046,23 @@ static int qca_setup(struct hci_uart *hu)
20462046
}
20472047

20482048
out:
2049-
if (ret && retries < MAX_INIT_RETRIES) {
2050-
bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
2049+
if (ret) {
20512050
qca_power_shutdown(hu);
2052-
if (hu->serdev) {
2053-
serdev_device_close(hu->serdev);
2054-
ret = serdev_device_open(hu->serdev);
2055-
if (ret) {
2056-
bt_dev_err(hdev, "failed to open port");
2057-
return ret;
2051+
2052+
if (retries < MAX_INIT_RETRIES) {
2053+
bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
2054+
if (hu->serdev) {
2055+
serdev_device_close(hu->serdev);
2056+
ret = serdev_device_open(hu->serdev);
2057+
if (ret) {
2058+
bt_dev_err(hdev, "failed to open port");
2059+
return ret;
2060+
}
20582061
}
2062+
retries++;
2063+
goto retry;
20592064
}
2060-
retries++;
2061-
goto retry;
2065+
return ret;
20622066
}
20632067

20642068
/* Setup bdaddr */

0 commit comments

Comments
 (0)