Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bafc6e4c authored by John Linville's avatar John Linville Committed by Kalle Valo
Browse files

mwl8k: refactor some conditionals for clarity



CC [M]  drivers/net/wireless/mwl8k.o
drivers/net/wireless/mwl8k.c: In function ‘mwl8k_bss_info_changed’:
drivers/net/wireless/mwl8k.c:3290:2: warning: ‘ap_mcs_rates’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  memcpy(cmd->mcs_set, mcs_rates, 16);
  ^
drivers/net/wireless/mwl8k.c:4987:5: note: ‘ap_mcs_rates’ was declared here
  u8 ap_mcs_rates[16];
     ^

The warning was bogus.  But the conditionals were rather complicated,
with multiple redundant checks.  This consolidates the checking and
makes it more readable IMHO.

Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9ff4b6de
Loading
Loading
Loading
Loading
+25 −24
Original line number Diff line number Diff line
@@ -5019,11 +5019,12 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		memcpy(ap_mcs_rates, ap->ht_cap.mcs.rx_mask, 16);

		rcu_read_unlock();
	}

	if ((changed & BSS_CHANGED_ASSOC) && vif->bss_conf.assoc &&
	    !priv->ap_fw) {
		rc = mwl8k_cmd_set_rate(hw, vif, ap_legacy_rates, ap_mcs_rates);
		if (changed & BSS_CHANGED_ASSOC) {
			if (!priv->ap_fw) {
				rc = mwl8k_cmd_set_rate(hw, vif,
							ap_legacy_rates,
							ap_mcs_rates);
				if (rc)
					goto out;

@@ -5031,8 +5032,6 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
				if (rc)
					goto out;
			} else {
		if ((changed & BSS_CHANGED_ASSOC) && vif->bss_conf.assoc &&
		    priv->ap_fw) {
				int idx;
				int rate;

@@ -5042,7 +5041,8 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
				if (idx)
					idx--;

			if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
				if (hw->conf.chandef.chan->band ==
				    IEEE80211_BAND_2GHZ)
					rate = mwl8k_rates_24[idx].hw_value;
				else
					rate = mwl8k_rates_50[idx].hw_value;
@@ -5050,6 +5050,7 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
				mwl8k_cmd_use_fixed_rate_ap(hw, rate, rate);
			}
		}
	}

	if (changed & BSS_CHANGED_ERP_PREAMBLE) {
		rc = mwl8k_set_radio_preamble(hw,