Skip to content
/ linux Public

Commit 31f2340

Browse files
Jinwang LiSasha Levin
authored andcommitted
Bluetooth: hci_qca: Cleanup on all setup failures
[ Upstream commit 5c4e9a8 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3242a14 commit 31f2340

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

drivers/bluetooth/hci_qca.c

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

19261926
out:
1927-
if (ret && retries < MAX_INIT_RETRIES) {
1928-
bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
1927+
if (ret) {
19291928
qca_power_shutdown(hu);
1930-
if (hu->serdev) {
1931-
serdev_device_close(hu->serdev);
1932-
ret = serdev_device_open(hu->serdev);
1933-
if (ret) {
1934-
bt_dev_err(hdev, "failed to open port");
1935-
return ret;
1929+
1930+
if (retries < MAX_INIT_RETRIES) {
1931+
bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
1932+
if (hu->serdev) {
1933+
serdev_device_close(hu->serdev);
1934+
ret = serdev_device_open(hu->serdev);
1935+
if (ret) {
1936+
bt_dev_err(hdev, "failed to open port");
1937+
return ret;
1938+
}
19361939
}
1940+
retries++;
1941+
goto retry;
19371942
}
1938-
retries++;
1939-
goto retry;
1943+
return ret;
19401944
}
19411945

19421946
/* Setup bdaddr */

0 commit comments

Comments
 (0)