If cfg80211 requests to connect when we have already had an active
profile, invalidate the current profile first before sending a new
profile to UMAC.
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
 
        iwm->umac_profile->mode = cpu_to_le32(iwm->conf.mode);
 
-       if (iwm->umac_profile_active) {
-               int ret = iwm_invalidate_mlme_profile(iwm);
-               if (ret < 0)
-                       IWM_ERR(iwm, "Couldn't invalidate profile\n");
-       }
+       if (iwm->umac_profile_active)
+               iwm_invalidate_mlme_profile(iwm);
 
        return 0;
 }
        if (!sme->ssid)
                return -EINVAL;
 
+       if (iwm->umac_profile_active) {
+               ret = iwm_invalidate_mlme_profile(iwm);
+               if (ret) {
+                       IWM_ERR(iwm, "Couldn't invalidate profile\n");
+                       return ret;
+               }
+       }
+
        if (chan)
                iwm->channel =
                        ieee80211_frequency_to_channel(chan->center_freq);