提交 354d0f3c 编写于 作者: L Larry Finger 提交者: John W. Linville

rtlwifi: Fix smatch warnings in usb.c

Smatch displays the following:
  CHECK   drivers/net/wireless/rtlwifi/usb.c
drivers/net/wireless/rtlwifi/usb.c:458 _rtl_usb_rx_process_agg() warn: assigning (-98) to unsigned variable 'stats.noise'
drivers/net/wireless/rtlwifi/usb.c:503 _rtl_usb_rx_process_noagg() warn: assigning (-98) to unsigned variable 'stats.noise'
drivers/net/wireless/rtlwifi/usb.c:596 _rtl_rx_get_padding() info: ignoring unreachable code.
drivers/net/wireless/rtlwifi/usb.c:596 _rtl_rx_get_padding() info: ignoring unreachable code.

The variable 'stats.noise' is not used, thus the initializers are removed.
The unreachable code info is fixed by including the appropriate section inside
#ifdef .. #endif constructions.
Signed-off-by: NLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 a3557d4d
...@@ -455,7 +455,6 @@ static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw, ...@@ -455,7 +455,6 @@ static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw,
struct ieee80211_rx_status rx_status = {0}; struct ieee80211_rx_status rx_status = {0};
struct rtl_stats stats = { struct rtl_stats stats = {
.signal = 0, .signal = 0,
.noise = -98,
.rate = 0, .rate = 0,
}; };
...@@ -498,7 +497,6 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw, ...@@ -498,7 +497,6 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw,
struct ieee80211_rx_status rx_status = {0}; struct ieee80211_rx_status rx_status = {0};
struct rtl_stats stats = { struct rtl_stats stats = {
.signal = 0, .signal = 0,
.noise = -98,
.rate = 0, .rate = 0,
}; };
...@@ -582,12 +580,15 @@ static void _rtl_rx_work(unsigned long param) ...@@ -582,12 +580,15 @@ static void _rtl_rx_work(unsigned long param)
static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr, static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr,
unsigned int len) unsigned int len)
{ {
#if NET_IP_ALIGN != 0
unsigned int padding = 0; unsigned int padding = 0;
#endif
/* make function no-op when possible */ /* make function no-op when possible */
if (NET_IP_ALIGN == 0 || len < sizeof(*hdr)) if (NET_IP_ALIGN == 0 || len < sizeof(*hdr))
return 0; return 0;
#if NET_IP_ALIGN != 0
/* alignment calculation as in lbtf_rx() / carl9170_rx_copy_data() */ /* alignment calculation as in lbtf_rx() / carl9170_rx_copy_data() */
/* TODO: deduplicate common code, define helper function instead? */ /* TODO: deduplicate common code, define helper function instead? */
...@@ -608,6 +609,7 @@ static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr, ...@@ -608,6 +609,7 @@ static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr,
padding ^= NET_IP_ALIGN; padding ^= NET_IP_ALIGN;
return padding; return padding;
#endif
} }
#define __RADIO_TAP_SIZE_RSV 32 #define __RADIO_TAP_SIZE_RSV 32
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册