mac80211: don't start the dynamic ps timer if not associated
[firefly-linux-kernel-4.4.55.git] / net / mac80211 / tx.c
index 081dcaf6577be41ff6444101b1ec2ce87ff7f349..bd1224fd216aeb034278d6cc34f3c38287ac754c 100644 (file)
@@ -169,7 +169,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
        return cpu_to_le16(dur);
 }
 
-static int inline is_ieee80211_device(struct ieee80211_local *local,
+static inline int is_ieee80211_device(struct ieee80211_local *local,
                                      struct net_device *dev)
 {
        return local == wdev_priv(dev->ieee80211_ptr);
@@ -237,6 +237,10 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
                                     &local->dynamic_ps_disable_work);
        }
 
+       /* Don't restart the timer if we're not disassociated */
+       if (!ifmgd->associated)
+               return TX_CONTINUE;
+
        mod_timer(&local->dynamic_ps_timer, jiffies +
                  msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));