spin_lock_irqsave(&priv->sta_list_spinlock, flags);
        sta_ptr = mwifiex_get_sta_entry(priv, addr);
-       spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
-
        if (!sta_ptr) {
+               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                wiphy_err(wiphy, "%s: Invalid TDLS peer %pM\n",
                          __func__, addr);
                return -ENOENT;
 
        if (!(sta_ptr->tdls_cap.extcap.ext_capab[3] &
              WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH)) {
+               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                wiphy_err(wiphy, "%pM do not support tdls cs\n", addr);
                return -ENOENT;
        }
 
        if (sta_ptr->tdls_status == TDLS_CHAN_SWITCHING ||
            sta_ptr->tdls_status == TDLS_IN_OFF_CHAN) {
+               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                wiphy_err(wiphy, "channel switch is running, abort request\n");
                return -EALREADY;
        }
+       spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
 
        chan = chandef->chan->hw_value;
        second_chan_offset = mwifiex_get_sec_chan_offset(chan);
 
        spin_lock_irqsave(&priv->sta_list_spinlock, flags);
        sta_ptr = mwifiex_get_sta_entry(priv, addr);
-       spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
-
        if (!sta_ptr) {
+               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                wiphy_err(wiphy, "%s: Invalid TDLS peer %pM\n",
                          __func__, addr);
        } else if (!(sta_ptr->tdls_status == TDLS_CHAN_SWITCHING ||
                     sta_ptr->tdls_status == TDLS_IN_BASE_CHAN ||
                     sta_ptr->tdls_status == TDLS_IN_OFF_CHAN)) {
+               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                wiphy_err(wiphy, "tdls chan switch not initialize by %pM\n",
                          addr);
-       } else
+       } else {
+               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                mwifiex_stop_tdls_cs(priv, addr);
+       }
 }
 
 static int
 
        } else {
                spin_lock_irqsave(&priv->sta_list_spinlock, flags);
                sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac);
-               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
-
                if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) {
                        sta_ptr->tx_pause = tp->tx_pause;
                        mwifiex_update_ralist_tx_pause(priv, tp->peermac,
                                                       tp->tx_pause);
                }
+               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
        }
 }
 
                if (mwifiex_is_tdls_link_setup(status)) {
                        spin_lock_irqsave(&priv->sta_list_spinlock, flags);
                        sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac);
-                       spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
-
                        if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) {
                                sta_ptr->tx_pause = tp->tx_pause;
                                mwifiex_update_ralist_tx_pause(priv,
                                                               tp->peermac,
                                                               tp->tx_pause);
                        }
+                       spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                }
        }
 }