wlan: Fix for scan failure when smeRoamConnect failed.

When SME Roam connect failed, we should not set state
to connecting.

Change-Id: Ib85c74697ca277c4f9d9504b59a4f1cd8d4db845
CR-Fixed: 422187
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 69548ea..5f2e329 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -76,6 +76,7 @@
 #include "sapInternal.h"
 #include "wlan_hdd_softap_tx_rx.h"
 #include "wlan_hdd_main.h"
+#include "wlan_hdd_assoc.h"
 #ifdef WLAN_BTAMP_FEATURE
 #include "bap_hdd_misc.h"
 #endif
@@ -4247,19 +4248,26 @@
 
         pRoamProfile->ChannelInfo.ChannelList = NULL;
         pRoamProfile->ChannelInfo.numOfChannels = 0;
+
+        if( (eHAL_STATUS_SUCCESS == status) &&
+            (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) )
+
+        {
+            hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
+                                                 eConnectionState_Connecting);
+        }
+
+        if( status != eHAL_STATUS_SUCCESS )
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect failed with "
+                                      "status %d", __func__, status);
+        }
     }
     else
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__);
         return -EINVAL;
     }
-
-    if( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
-    {
-        (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState =
-                                 eConnectionState_Connecting;
-    }
-
     EXIT();
     return status;
 }