ath9k: dynack: check da->enabled first in sampling routines [Linux 4.9.156]

This Linux kernel change "ath9k: dynack: check da->enabled first in sampling routines" is included in the Linux 4.9.156 release. This change is authored by Lorenzo Bianconi <lorenzo.bianconi [at] redhat.com> on Fri Nov 2 21:49:57 2018 +0100. The commit for this change in Linux stable tree is f871402 (patch) which is from upstream commit 9d3d65a. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 9d3d65a.

ath9k: dynack: check da->enabled first in sampling routines

commit 9d3d65a91f027b8a9af5e63752d9b78cb10eb92d upstream.

Check da->enabled flag first in ath_dynack_sample_tx_ts and
ath_dynack_sample_ack_ts routines in order to avoid useless
processing

Tested-by: Koen Vandeputte <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/wireless/ath/ath9k/dynack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c
index d2a7531..6e236a4 100644
--- a/drivers/net/wireless/ath/ath9k/dynack.c
+++ b/drivers/net/wireless/ath/ath9k/dynack.c
@@ -184,7 +184,7 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
    struct ath_common *common = ath9k_hw_common(ah);
    struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);

-   if ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !da->enabled)
+   if (!da->enabled || (info->flags & IEEE80211_TX_CTL_NO_ACK))
        return;

    spin_lock_bh(&da->qlock);
@@ -266,7 +266,7 @@ void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb,
    struct ath_common *common = ath9k_hw_common(ah);
    struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;

-   if (!ath_dynack_bssidmask(ah, hdr->addr1) || !da->enabled)
+   if (!da->enabled || !ath_dynack_bssidmask(ah, hdr->addr1))
        return;

    spin_lock_bh(&da->qlock);

Leave a Reply

Your email address will not be published. Required fields are marked *