wlan:Set the hdd state to not connected even if disconnect timeout.

If disconnect command is queued in SME and same time the connect
is in progress which failed eventualy, driver will not call the
disconnect handler leading to the wait for disconnect handler
timeout. This timeout will leave the hdd state as disconneting
and thus the next connect commands will always try to disconnect
thinking that disconnect is still in progress leading to connect
return with failure.

With this fix hdd will set the hdd state from disconnecting to
not connected even if disconnect timeout.

Change-Id: Ib4eb403872b435746c598f162195194e32ea43f7
CRs-Fixed: 763699
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 4242403..cf86cab 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -11235,7 +11235,7 @@
  */
 int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
 {
-    int status;
+    int status, result = 0;
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     long ret;
@@ -11293,7 +11293,8 @@
         hddLog(VOS_TRACE_LEVEL_ERROR,
                "%s csrRoamDisconnect failure, returned %d",
                __func__, (int)status );
-        return -EINVAL;
+        result = -EINVAL;
+        goto disconnected;
     }
     ret = wait_for_completion_interruptible_timeout(
                 &pAdapter->disconnect_comp_var,
@@ -11302,19 +11303,20 @@
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
               "%s: Failed to disconnect, timed out", __func__);
-        return -ETIMEDOUT;
+        result = -ETIMEDOUT;
     }
     else if (ret == -ERESTARTSYS)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                "%s: Failed to disconnect, wait interrupted", __func__);
-        return ret;
+        result = -ERESTARTSYS;
     }
+disconnected:
     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               FL("Set HDD connState to eConnectionState_NotConnected"));
     pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
 
-    return 0;
+    return result;
 }