Commit 3544f9f1 authored by Larry Finger's avatar Larry Finger Committed by Kalle Valo

rtlwifi: rtl8192c-common: Fix two typos

In this driver, two variables are masked by one quantity, and then tested
against a second number with more bits that the mask. Accordingly, the
test always fails. To minimize the possibility of such typos, a symbolic
definition of the mask is created and used.

The separate load and mask operations are also combined into a single
statement.
Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: David Binderman <dcb314@hotmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 8d882bcf
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) #define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1)
#define BT_RSSI_STATE_BG_EDCA_LOW BIT_OFFSET_LEN_MASK_32(3, 1) #define BT_RSSI_STATE_BG_EDCA_LOW BIT_OFFSET_LEN_MASK_32(3, 1)
#define BT_RSSI_STATE_TXPOWER_LOW BIT_OFFSET_LEN_MASK_32(4, 1) #define BT_RSSI_STATE_TXPOWER_LOW BIT_OFFSET_LEN_MASK_32(4, 1)
#define BT_MASK 0x00ffffff
#define RTLPRIV (struct rtl_priv *) #define RTLPRIV (struct rtl_priv *)
#define GET_UNDECORATED_AVERAGE_RSSI(_priv) \ #define GET_UNDECORATED_AVERAGE_RSSI(_priv) \
...@@ -1536,13 +1537,11 @@ static bool rtl92c_bt_state_change(struct ieee80211_hw *hw) ...@@ -1536,13 +1537,11 @@ static bool rtl92c_bt_state_change(struct ieee80211_hw *hw)
return false; return false;
bt_state = rtl_read_byte(rtlpriv, 0x4fd); bt_state = rtl_read_byte(rtlpriv, 0x4fd);
bt_tx = rtl_read_dword(rtlpriv, 0x488); bt_tx = rtl_read_dword(rtlpriv, 0x488) & BT_MASK;
bt_tx = bt_tx & 0x00ffffff; bt_pri = rtl_read_dword(rtlpriv, 0x48c) & BT_MASK;
bt_pri = rtl_read_dword(rtlpriv, 0x48c);
bt_pri = bt_pri & 0x00ffffff;
polling = rtl_read_dword(rtlpriv, 0x490); polling = rtl_read_dword(rtlpriv, 0x490);
if (bt_tx == 0xffffffff && bt_pri == 0xffffffff && if (bt_tx == BT_MASK && bt_pri == BT_MASK &&
polling == 0xffffffff && bt_state == 0xff) polling == 0xffffffff && bt_state == 0xff)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment