Skip to content

Commit 17eea99

Browse files
committed
Enables warning in the compiler and fixes some issues, reference => https://github.com/diederikdehaas/rtl8812AU
1 parent 2bb47d2 commit 17eea99

File tree

8 files changed

+34
-16
lines changed

8 files changed

+34
-16
lines changed

drivers/net/wireless/realtek/rtl8192cu/Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
11
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
22
EXTRA_CFLAGS += -O1
33
#EXTRA_CFLAGS += -O3
4-
#EXTRA_CFLAGS += -Wall
5-
#EXTRA_CFLAGS += -Wextra
4+
EXTRA_CFLAGS += -Wall
5+
EXTRA_CFLAGS += -Wextra
66
#EXTRA_CFLAGS += -Werror
77
#EXTRA_CFLAGS += -pedantic
88
#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
99

10+
# The "$(call cc-option,-Wxxx)" macro only includes that option when it's
11+
# supported by the compiler used. It may only work on Debian systems.
12+
13+
# Wdate-time was added in gcc-4.9
14+
EXTRA_CFLAGS += $(call cc-option,-Werror=date-time)
15+
# Wincompatible-pointer-types was added in gcc-5.0
16+
EXTRA_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
17+
1018
EXTRA_CFLAGS += -Wno-unused-variable
1119
EXTRA_CFLAGS += -Wno-unused-value
1220
EXTRA_CFLAGS += -Wno-unused-label
1321
EXTRA_CFLAGS += -Wno-unused-parameter
1422
EXTRA_CFLAGS += -Wno-unused-function
1523
EXTRA_CFLAGS += -Wno-unused
1624

17-
EXTRA_CFLAGS += -Wno-uninitialized
25+
# Relax some warnings from '-Wextra' so we won't get flooded with warnings
26+
EXTRA_CFLAGS += -Wno-sign-compare
27+
EXTRA_CFLAGS += -Wno-missing-field-initializers
28+
29+
#EXTRA_CFLAGS += -Wno-uninitialized
1830

1931
EXTRA_CFLAGS += -I$(src)/include
2032

33+
EXTRA_LDFLAGS += --strip-debug
34+
2135
CONFIG_AUTOCFG_CP = n
2236

2337
CONFIG_RTL8192C = y

drivers/net/wireless/realtek/rtl8192cu/core/rtw_ap.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d
210210
PNDIS_802_11_VARIABLE_IEs pIE;
211211
u8 bmatch = _FALSE;
212212
u8 *pie = pnetwork->IEs;
213-
u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
213+
u8 *p=NULL, *dst_ie=NULL, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
214214
u32 i, offset, ielen, ie_offset, remainder_ielen = 0;
215215

216216
for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;)
@@ -250,6 +250,9 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d
250250
dst_ie = (p+ielen);
251251
}
252252

253+
if(dst_ie == NULL)
254+
return;
255+
253256
if(remainder_ielen>0)
254257
{
255258
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
@@ -357,7 +360,7 @@ void expire_timeout_chk(_adapter *padapter)
357360
{
358361
_irqL irqL;
359362
_list *phead, *plist;
360-
u8 updated;
363+
u8 updated = _FALSE;
361364
struct sta_info *psta=NULL;
362365
struct sta_priv *pstapriv = &padapter->stapriv;
363366
u8 chk_alive_num = 0;

drivers/net/wireless/realtek/rtl8192cu/core/rtw_ieee80211.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,8 @@ int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8* category, u8 *act
18591859
{
18601860
const u8 *frame_body = frame + sizeof(struct rtw_ieee80211_hdr_3addr);
18611861
u16 fc;
1862-
u8 c, a;
1862+
u8 c;
1863+
u8 a = ACT_PUBLIC_MAX;
18631864

18641865
fc = le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)frame)->frame_ctl);
18651866

drivers/net/wireless/realtek/rtl8192cu/core/rtw_mlme_ext.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,7 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
24542454
psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe));
24552455
if(psta)
24562456
{
2457-
u8 updated;
2457+
u8 updated = _FALSE;
24582458

24592459
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
24602460
if(rtw_is_list_empty(&psta->asoc_list)==_FALSE)
@@ -2548,7 +2548,7 @@ unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
25482548
psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe));
25492549
if(psta)
25502550
{
2551-
u8 updated;
2551+
u8 updated = _FALSE;
25522552

25532553
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
25542554
if(rtw_is_list_empty(&psta->asoc_list)==_FALSE)
@@ -5663,7 +5663,7 @@ unsigned int on_action_public_p2p(union recv_frame *precv_frame)
56635663

56645664
// Commented by Kurt 20120113
56655665
// Get peer_dev_addr here if peer doesn't issue prov_disc frame.
5666-
if( _rtw_memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN) );
5666+
if( _rtw_memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN) )
56675667
_rtw_memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN);
56685668

56695669
result = process_p2p_group_negotation_req( pwdinfo, frame_body, len );

drivers/net/wireless/realtek/rtl8192cu/core/rtw_xmit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2590,7 +2590,7 @@ struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv)
25902590
s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe)
25912591
{
25922592
_irqL irqL;
2593-
_queue *queue;
2593+
_queue *queue = NULL;
25942594
_adapter *padapter = pxmitpriv->adapter;
25952595
_pkt *pndis_pkt = NULL;
25962596

drivers/net/wireless/realtek/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static void getTxPowerWriteValByRegulatory(
373373
{
374374
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
375375
struct dm_priv *pdmpriv = &pHalData->dmpriv;
376-
u8 i, chnlGroup, pwr_diff_limit[4];
376+
u8 i, chnlGroup = 0, pwr_diff_limit[4];
377377
u32 writeVal, customer_limit, rf;
378378

379379
//
@@ -615,7 +615,7 @@ phy_RF6052_Config_ParaFile(
615615
IN PADAPTER Adapter
616616
)
617617
{
618-
u32 u4RegValue;
618+
u32 u4RegValue=0;
619619
u8 eRFPath;
620620
BB_REGISTER_DEFINITION_T *pPhyReg;
621621

drivers/net/wireless/realtek/rtl8192cu/os_dep/linux/ioctl_linux.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6584,7 +6584,6 @@ static int rtw_dbg_port(struct net_device *dev,
65846584
case 0x01: //dbg mode
65856585
padapter->recvpriv.is_signal_dbg = 1;
65866586
extra_arg = extra_arg>100?100:extra_arg;
6587-
extra_arg = extra_arg<0?0:extra_arg;
65886587
padapter->recvpriv.signal_strength_dbg=extra_arg;
65896588
break;
65906589
}
@@ -6956,7 +6955,7 @@ static int rtw_dbg_port(struct net_device *dev,
69566955
{
69576956
struct registry_priv *pregpriv = &padapter->registrypriv;
69586957
// 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec)
6959-
if( pregpriv && extra_arg >= 0 && extra_arg < 3 )
6958+
if( pregpriv && extra_arg < 3 )
69606959
{
69616960
pregpriv->ampdu_enable= extra_arg;
69626961
DBG_871X("set ampdu_enable=%d\n",pregpriv->ampdu_enable);

drivers/net/wireless/realtek/rtl8192cu/os_dep/linux/usb_intf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ static int rtw_resume(struct usb_interface *pusb_intf)
995995
int rtw_resume_process(_adapter *padapter)
996996
{
997997
struct net_device *pnetdev;
998-
struct pwrctrl_priv *pwrpriv;
998+
struct pwrctrl_priv *pwrpriv=NULL;
999999
int ret = -1;
10001000
u32 start_time = rtw_get_current_time();
10011001
_func_enter_;
@@ -1058,7 +1058,8 @@ int rtw_resume_process(_adapter *padapter)
10581058
rtw_unlock_suspend();
10591059
#endif //CONFIG_RESUME_IN_WORKQUEUE
10601060

1061-
pwrpriv->bInSuspend = _FALSE;
1061+
if (pwrpriv)
1062+
pwrpriv->bInSuspend = _FALSE;
10621063
DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__
10631064
, ret, rtw_get_passing_time_ms(start_time));
10641065

0 commit comments

Comments
 (0)