Skip to contentSkip to conversation

mac80211: remove redundant flag check

PATCH In review [email protected] 2 participants 2 messages Dec 23, 2013 – Jan 6, 2014 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: remove redundant flag check

From: Fred Chou <[email protected]>

It's not necessary to check a flag setting and then set it anyway. The outer condition check is redundant in the code below. Remove the outer if.

---
 net/mac80211/tx.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
net/mac80211/tx.c +5 -7
index 2f0e176..52bb276 100644
@@ -1157,13 +1157,11 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
 		info->flags |= IEEE80211_TX_CTL_NO_ACK;
 	} else
 		tx->flags |= IEEE80211_TX_UNICAST;
-
-	if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) {
-		if (!(tx->flags & IEEE80211_TX_UNICAST) ||
-		    skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
-		    info->flags & IEEE80211_TX_CTL_AMPDU)
-			info->flags |= IEEE80211_TX_CTL_DONTFRAG;
-	}
+
+	if (!(tx->flags & IEEE80211_TX_UNICAST) ||
+	    skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
+	    info->flags & IEEE80211_TX_CTL_AMPDU)
+		info->flags |= IEEE80211_TX_CTL_DONTFRAG;
 
 	if (!tx->sta)
 		info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 5 lines · On Mon, 2013-12-23 at 19:07 +0800, [email protected] wrote:

From: Fred Chou <[email protected]>

It's not necessary to check a flag setting and then set it anyway. The outer condition check is redundant in the code below. Remove the outer if.

It may be redundant in theory, but I think it makes the code easier to read, and it avoids all the other checks and the flags write. I don't think I want to apply this.

johannes