Search Linux Wireless

[PATCH 2/4] mac80211: move early error branch check on ieee80211_set_freq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This has no functional change, we just move the bad case error check
early as we will soon add some more and this will make this easier to
read.

Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx>
---
 net/mac80211/util.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index e0431a1..32610a0 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -793,19 +793,20 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
 
 	chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
 
-	if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
-		if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
-		    chan->flags & IEEE80211_CHAN_NO_IBSS)
-			return ret;
-		local->oper_channel = chan;
-		local->oper_channel_type = NL80211_CHAN_NO_HT;
-
-		if (local->sw_scanning || local->hw_scanning)
-			ret = 0;
-		else
-			ret = ieee80211_hw_config(
-				local, IEEE80211_CONF_CHANGE_CHANNEL);
-	}
+	if (!chan || (chan->flags & IEEE80211_CHAN_DISABLED))
+		return ret;
+
+	if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
+	    chan->flags & IEEE80211_CHAN_NO_IBSS)
+		return ret;
+	local->oper_channel = chan;
+	local->oper_channel_type = NL80211_CHAN_NO_HT;
+
+	if (local->sw_scanning || local->hw_scanning)
+		ret = 0;
+	else
+		ret = ieee80211_hw_config(
+			local, IEEE80211_CONF_CHANGE_CHANNEL);
 
 	return ret;
 }
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux