summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-08-23 16:22:51 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-24 02:26:10 +0300
commita084cda42ece32c83c190db0681f4675d9c41021 (patch)
treeade3cf8d9ee1ef51e13c4b6a5488f8c1d4c7ae22
parente4f857f739fbd15fd36f10e7caab95779c1dc1e4 (diff)
downloadlinux-a084cda42ece32c83c190db0681f4675d9c41021.tar.xz
staging: rtlwifi: shut up -Wmaybe-uninitialized warning
This function contains a series of interdependent conditions, slightly more than gcc can follow handle apparently: drivers/staging/rtlwifi/base.c: In function 'rtl_check_beacon_key': drivers/staging/rtlwifi/base.c:2546:34: error: 'ht_cap_ie' may be used uninitialized in this function [-Werror=maybe-uninitialized] This moves the code around a bit, to simplify the conditions enough that gcc can see that all variables are correctly initialized. Fixes: 56bde846304e ("staging: r8822be: Add existing rtlwifi and rtl_pci parts for new driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rtlwifi/base.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index f7f207cbaee3..b81f0a943eb4 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -2471,7 +2471,7 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
struct ieee80211_hdr *hdr = data;
struct ieee80211_ht_cap *ht_cap_ie;
struct ieee80211_ht_operation *ht_oper_ie = NULL;
- struct rtl_beacon_keys bcn_key;
+ struct rtl_beacon_keys bcn_key = {};
struct rtl_beacon_keys *cur_bcn_key;
u8 *ht_cap;
u8 ht_cap_len;
@@ -2509,10 +2509,12 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
/***** Parsing DS Param IE ******/
ds_param = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_DS_PARAMS);
- if (ds_param && !(ds_param[1] < sizeof(*ds_param)))
+ if (ds_param && !(ds_param[1] < sizeof(*ds_param))) {
ds_param_len = ds_param[1];
- else
+ bcn_key.bcn_channel = ds_param[2];
+ } else {
ds_param = NULL;
+ }
/***** Parsing HT Cap. IE ******/
ht_cap = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_HT_CAPABILITY);
@@ -2520,6 +2522,7 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
if (ht_cap && !(ht_cap[1] < sizeof(*ht_cap))) {
ht_cap_len = ht_cap[1];
ht_cap_ie = (struct ieee80211_ht_cap *)&ht_cap[2];
+ bcn_key.ht_cap_info = ht_cap_ie->cap_info;
} else {
ht_cap = NULL;
}
@@ -2535,16 +2538,10 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
}
/* update bcn_key */
- memset(&bcn_key, 0, sizeof(bcn_key));
- if (ds_param)
- bcn_key.bcn_channel = ds_param[2];
- else if (ht_oper && ht_oper_ie)
+ if (!ds_param && ht_oper && ht_oper_ie)
bcn_key.bcn_channel = ht_oper_ie->primary_chan;
- if (ht_cap)
- bcn_key.ht_cap_info = ht_cap_ie->cap_info;
-
if (ht_oper && ht_oper_ie)
bcn_key.ht_info_infos_0_sco = ht_oper_ie->ht_param & 0x03;