Commit 5c4e9a8b authored by Jinwang Li's avatar Jinwang Li Committed by Luiz Augusto von Dentz
Browse files

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: 9e80587a ("Bluetooth: hci_qca: Enhance retry logic in qca_setup")
Signed-off-by: default avatarJinwang Li <jinwang.li@oss.qualcomm.com>
Reviewed-by: default avatarBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent 21e4271e
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -2046,9 +2046,11 @@ static int qca_setup(struct hci_uart *hu)
	}

out:
	if (ret && retries < MAX_INIT_RETRIES) {
		bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
	if (ret) {
		qca_power_shutdown(hu);

		if (retries < MAX_INIT_RETRIES) {
			bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
			if (hu->serdev) {
				serdev_device_close(hu->serdev);
				ret = serdev_device_open(hu->serdev);
@@ -2060,6 +2062,8 @@ static int qca_setup(struct hci_uart *hu)
			retries++;
			goto retry;
		}
		return ret;
	}

	/* Setup bdaddr */
	if (soc_type == QCA_ROME)