qcacld-3.0: Indicate failure to HDD if HW mode change timesout

If HW mode change timeout happens during connect req in CSR,
the status received by HDD is success and it assumes connect is
queued and does not reset the HDD state. This lead to subsequent
scan failures.

To fix, return failure status to HDD if HW mode change timesout.
Also avoid sending QDF status to supplicant as part of connect
failure.

Change-Id: I49d189ad75a585d894b5e819190c2dc3d9cc1453
CRs-fixed: 2031149
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 852c972..896e98f 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -13039,9 +13039,9 @@
 			pHddCtx->hdd_psoc, false);
 		if (policy_mgr_is_hw_mode_change_in_progress(
 			pHddCtx->hdd_psoc)) {
-			status = policy_mgr_wait_for_connection_update(
+			qdf_status = policy_mgr_wait_for_connection_update(
 				pHddCtx->hdd_psoc);
-			if (!QDF_IS_STATUS_SUCCESS(status)) {
+			if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 				hdd_err("qdf wait for event failed!!");
 				status = -EINVAL;
 				goto ret_status;
@@ -13167,9 +13167,9 @@
 			 * to firmware if power save is enabled by the
 			 * firmware.
 			 */
-			status = hdd_set_ibss_power_save_params(pAdapter);
+			qdf_status = hdd_set_ibss_power_save_params(pAdapter);
 
-			if (QDF_STATUS_SUCCESS != status) {
+			if (QDF_STATUS_SUCCESS != qdf_status) {
 				hdd_err("Set IBSS Power Save Params Failed");
 				status = -EINVAL;
 				goto conn_failure;
@@ -13271,6 +13271,8 @@
 		qdf_status = sme_roam_connect(WLAN_HDD_GET_HAL_CTX(pAdapter),
 					  pAdapter->sessionId, pRoamProfile,
 					  &roamId);
+		if (QDF_IS_STATUS_ERROR(qdf_status))
+			status = qdf_status_to_os_return(qdf_status);
 
 		if ((QDF_STATUS_SUCCESS != qdf_status) &&
 		    (QDF_STA_MODE == pAdapter->device_mode ||
@@ -13278,7 +13280,6 @@
 			hdd_err("sme_roam_connect (session %d) failed with "
 			       "qdf_status %d. -> NotConnected",
 			       pAdapter->sessionId, qdf_status);
-			status = qdf_status_to_os_return(qdf_status);
 			/* change back to NotAssociated */
 			hdd_conn_set_connection_state(pAdapter,
 						      eConnectionState_NotConnected);