rtlwifi: rtl8821ae: Fix an expression that is always false
authorLarry Finger <Larry.Finger@lwfinger.net>
Wed, 8 Jul 2015 15:18:50 +0000 (10:18 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 21 Jul 2015 14:58:41 +0000 (17:58 +0300)
In routine _rtl8821ae_set_media_status(), an incorrect mask results in a test
for AP status to always be false. Similar bugs were fixed in rtl8192cu and
rtl8192de, but this instance was missed at that time.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [3.18+]
Cc: David Binderman <dcb314@hotmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
drivers/net/wireless/rtlwifi/rtl8821ae/reg.h

index 3236d44b459df69efd4f2b363f4b651e478a10a4..b7f18e2155eb18358cf4d4f9f3f82774f9b6f522 100644 (file)
@@ -2180,7 +2180,7 @@ static int _rtl8821ae_set_media_status(struct ieee80211_hw *hw,
 
        rtl_write_byte(rtlpriv, MSR, bt_msr);
        rtlpriv->cfg->ops->led_control(hw, ledaction);
-       if ((bt_msr & 0xfc) == MSR_AP)
+       if ((bt_msr & MSR_MASK) == MSR_AP)
                rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00);
        else
                rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66);
index 53668fc8f23e211dab03085359ce013fc65b81c2..1d6110f9c1fb6e29e75e8bde9c1533b026a8b757 100644 (file)
 #define        MSR_ADHOC                               0x01
 #define        MSR_INFRA                               0x02
 #define        MSR_AP                                  0x03
+#define MSR_MASK                               0x03
 
 #define        RRSR_RSC_OFFSET                         21
 #define        RRSR_SHORT_OFFSET                       23