staging: rtl8723bs: some code cleanup
cover staging: rtl8723bs: some code cleanup
Fix some warnings of '-Wunused-but-set-variable'.
Jason Yan (7):
staging: rtl8723bs: os_dep: remove set but not used 'uintRet'
staging: rtl8723bs: os_dep: remove set but not used 'size'
Staging: rtl8723bs: core: remove set but not used 'ptxservq'
staging: rtl8723bs: core: remove set but not used 'algthm'
staging: rtl8723bs: core: remove set but not used 'listen_interval'
staging: rtl8723bs: core: remove set but not used 'pwrpriv'
staging: rtl8723bs: core: remove set but not used 'pframe'
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +----- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 7 ++----- drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 2 -- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 11 ----------- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ++++-- 5 files changed, 7 insertions(+), 25 deletions(-)
Signature · 1 line
2.21.1
PATCH 1/7 staging: rtl8723bs: os_dep: remove set but not used 'uintRet'
Fix the following gcc warning:
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:2564:22: warning:
variable ‘uintRet’ set but not used [-Wunused-but-set-variable]
unsigned int uintRet = 0;
^~~~~~~--- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +4 -2
@@ -2561,14 +2561,16 @@ static int rtw_wps_start(struct net_device *dev,struct adapter *padapter = (struct adapter *)rtw_netdev_priv (dev);struct iw_point *pdata = &wrqu->data;u32 u32wps_start =0 ; -unsigned int uintRet =0 ;if ((true == padapter->bDriverStopped) || (true == padapter->bSurpriseRemoved) || (NULL == pdata)) { ret = -EINVAL ; goto exit; } - uintRet =copy_from_user ((void *)&u32wps_start, pdata->pointer,4 ); +if (copy_from_user ((void *)&u32wps_start, pdata->pointer,4 )) { + ret = -EFAULT ; + goto exit; + }if (u32wps_start ==0 ) u32wps_start = *extra;
Signature · 1 line
2.21.1
Greg KH
maintainerRe: [PATCH 1/7] staging: rtl8723bs: os_dep: remove set but not used 'uintRet'
Quoted 23 lines · Jason Yan
Fix the following gcc warning:
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:2564:22: warning:
variable ‘uintRet’ set but not used [-Wunused-but-set-variable]unsigned int uintRet = 0; ^~~~~~~Reported-by Hulk Robot <[email protected]>Signed-off-by Jason Yan <[email protected]>--- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0
-1@@ -2561,14 +2561,16 @@ static int rtw_wps_start(struct net_device *dev,struct adapter *padapter = (struct adapter *)rtw_netdev_priv (dev);struct iw_point *pdata = &wrqu->data;u32 u32wps_start =0 ; -unsigned int uintRet =0 ;
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c static int rtw_wps_start(struct net_device *dev, · line 2573
Quoted 10 lines
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +4
-1if ((true == padapter->bDriverStopped) || (true == padapter->bSurpriseRemoved) || (NULL == pdata)) { ret = -EINVAL ; goto exit; } - uintRet =copy_from_user ((void *)&u32wps_start, pdata->pointer,4 ); +if (copy_from_user ((void *)&u32wps_start, pdata->pointer,4 )) { + ret = -EFAULT ; + goto exit; + }
This also fixes the issue of copy_from_user not being checked, nice!
greg k-h
PATCH 2/7 staging: rtl8723bs: os_dep: remove set but not used 'size'
In reply to Jason YanAnd also remove the NULL check before kfree() because kfree() can handle NULL pointers correctly.
Fix the following gcc warning:
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:157:6: warning:
variable ‘size’ set but not used [-Wunused-but-set-variable]
u32 size = 0;
^~~~--- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +0 -11
@@ -154,17 +154,6 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(static void rtw_spt_band_free (struct ieee80211_supported_band *spt_band) { -u32 size =0 ; - -if (!spt_band) -return ; - -if (spt_band->band ==NL80211_BAND_2GHZ ) - { - size =sizeof (struct ieee80211_supported_band ) - +sizeof (struct ieee80211_channel )*RTW_2G_CHANNELS_NUM - +sizeof (struct ieee80211_rate )*RTW_G_RATES_NUM ; - }kfree (spt_band); }
Signature · 1 line
2.21.1
Greg KH
maintainerRe: [PATCH 2/7] staging: rtl8723bs: os_dep: remove set but not used 'size'
Quoted 27 lines · Jason Yan
And also remove the NULL check before
kfree()becausekfree()can handle NULL pointers correctly.Fix the following gcc warning:
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:157:6: warning:
variable ‘size’ set but not used [-Wunused-but-set-variable]u32 size = 0; ^~~~Reported-by Hulk Robot <[email protected]>Signed-off-by Jason Yan <[email protected]>--- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 11 ----------- 1 file changed, 11 deletions(-)drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +0
-3@@ -154,17 +154,6 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(static void rtw_spt_band_free (struct ieee80211_supported_band *spt_band) { -u32 size =0 ; - -if (!spt_band)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c static struct ieee80211_supported_band *rtw_spt_band_alloc( · line 158
Quoted 10 lines
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +0
-8-return ; - -if (spt_band->band ==NL80211_BAND_2GHZ ) - { - size =sizeof (struct ieee80211_supported_band ) - +sizeof (struct ieee80211_channel )*RTW_2G_CHANNELS_NUM - +sizeof (struct ieee80211_rate )*RTW_G_RATES_NUM ; - }kfree (spt_band); }
This function can now be removed and replaced with the call to kfree(), right? Can you send a follow-on patch to do that?
thanks,
greg k-h
Re: [PATCH 2/7] staging: rtl8723bs: os_dep: remove set but not used 'size'
Quoted 33 lines · Greg KH
Quoted 32 lines · Jason Yan
And also remove the NULL check before
kfree()becausekfree()can handle NULL pointers correctly.Fix the following gcc warning:
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:157:6: warning:
variable ‘size’ set but not used [-Wunused-but-set-variable]u32 size = 0; ^~~~Reported-by Hulk Robot <[email protected]>Signed-off-by Jason Yan <[email protected]>--- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 11 ----------- 1 file changed, 11 deletions(-)drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +0
-8@@ -154,17 +154,6 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(static void rtw_spt_band_free (struct ieee80211_supported_band *spt_band) { -u32 size =0 ; - -if (!spt_band) -return ; - -if (spt_band->band ==NL80211_BAND_2GHZ ) - { - size =sizeof (struct ieee80211_supported_band )
Quoted 9 lines
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c static struct ieee80211_supported_band *rtw_spt_band_alloc( · line 158
Quoted 5 lines
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +0
-3- +sizeof (struct ieee80211_channel )*RTW_2G_CHANNELS_NUM - +sizeof (struct ieee80211_rate )*RTW_G_RATES_NUM ; - }kfree (spt_band); }This function can now be removed and replaced with the call to
kfree(), right? Can you send a follow-on patch to do that?
Sure.
Quoted 6 lines
thanks,
greg k-h
.
PATCH 3/7 Staging: rtl8723bs: core: remove set but not used 'ptxservq'
In reply to Jason YanFix the following gcc warning:
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c:556:19: warning: variable ‘ptxservq’ set but not used [-Wunused-but-set-variable]
struct tx_servq *ptxservq;
^~~~~~~~--- drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c +0 -2
@@ -553,7 +553,6 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter) {struct sta_info *psta; -struct tx_servq *ptxservq;u32 res = _SUCCESS;NDIS_802_11_MAC_ADDRESS bcast_addr = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };
@@ -571,7 +570,6 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)/* default broadcast & multicast use macid 1 */ psta->mac_id =1 ; - ptxservq = &(psta->sta_xmitpriv.be_q); exit:return _SUCCESS; }
Signature · 1 line
2.21.1
PATCH 4/7 staging: rtl8723bs: core: remove set but not used 'algthm'
In reply to Jason YanFix the following gcc warning:
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1087:33: warning: variable ‘algthm’ set but not used [-Wunused-but-set-variable]
unsigned int seq, len, status, algthm, offset;
^~~~~~
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1 -2
@@ -1084,7 +1084,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)unsigned int OnAuthClient (struct adapter *padapter,union recv_frame *precv_frame) { -unsigned int seq, len, status, algthm, offset; +unsigned int seq, len, status, offset;unsigned char *p;unsigned int go2asoc =0 ;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1103,7 +1103,6 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram offset = (GetPrivacy (pframe)) ?4 :0 ; - algthm =le16_to_cpu (*(__le16 *)((SIZE_PTR )pframe +WLAN_HDR_A3_LEN + offset)); seq =le16_to_cpu (*(__le16 *)((SIZE_PTR )pframe +WLAN_HDR_A3_LEN + offset +2 )); status =le16_to_cpu (*(__le16 *)((SIZE_PTR )pframe +WLAN_HDR_A3_LEN + offset +4 ));
Signature · 1 line
2.21.1
PATCH 5/7 staging: rtl8723bs: core: remove set but not used 'listen_interval'
In reply to Jason YanFix the following gcc warning:
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1173:18: warning: variable ‘listen_interval’ set but not used [-Wunused-but-set-variable]
u16 capab_info, listen_interval;
^~~~~~~~~~~~~~~--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1 -3
@@ -1169,7 +1169,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_framunsigned int OnAssocReq (struct adapter *padapter,union recv_frame *precv_frame) { -u16 capab_info, listen_interval; +u16 capab_info;struct rtw_ieee802_11_elems elems;struct sta_info *pstat;unsigned char reassoc, *p, *pos, *wpa_ie;
@@ -1215,8 +1215,6 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) capab_info =RTW_GET_LE16 (pframe +WLAN_HDR_A3_LEN );/* capab_info = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); */ -/* listen_interval = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN+2)); */ - listen_interval =RTW_GET_LE16 (pframe +WLAN_HDR_A3_LEN +2 ); left = pkt_len - (sizeof (struct ieee80211_hdr_3addr ) + ie_offset); pos = pframe + (sizeof (struct ieee80211_hdr_3addr ) + ie_offset);
Signature · 1 line
2.21.1
PATCH 6/7 staging: rtl8723bs: core: remove set but not used 'pwrpriv'
In reply to Jason YanFix the following gcc warning:
drivers/staging/rtl8723bs/core/rtw_mlme.c:1100:24: warning: variable ‘pwrpriv’ set but not used [-Wunused-but-set-variable]
struct pwrctrl_priv *pwrpriv;
^~~~~~~--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +0 -3
@@ -1097,9 +1097,6 @@ inline void rtw_indicate_scan_done(struct adapter *padapter, bool aborted) (!adapter_to_pwrctl(padapter)->bInSuspend) && (!check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE|WIFI_UNDER_LINKING))) { -struct pwrctrl_priv *pwrpriv; - - pwrpriv =adapter_to_pwrctl (padapter);rtw_set_ips_deny (padapter,0 );_set_timer (&padapter->mlmepriv.dynamic_chk_timer,1 ); }
Signature · 1 line
2.21.1
PATCH 7/7 staging: rtl8723bs: core: remove set but not used 'pframe'
In reply to Jason YanFix the following gcc warning:
drivers/staging/rtl8723bs/core/rtw_mlme.c:2920:6: warning: variable ‘pframe’ set but not used [-Wunused-but-set-variable]
u8 *pframe;
^~~~~~--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +1 -2
@@ -2914,12 +2914,11 @@ void rtw_append_exented_cap(struct adapter *padapter, u8 *out_ie, uint *pout_lenstruct mlme_priv *pmlmepriv = &padapter->mlmepriv;struct ht_priv *phtpriv = &pmlmepriv->htpriv;u8 cap_content[8 ] = {0 }; -u8 *pframe;if (phtpriv->bss_coexist)SET_EXT_CAPABILITY_ELE_BSS_COEXIST (cap_content,1 ); - pframe =rtw_set_ie (out_ie + *pout_len, EID_EXTCapability,8 , cap_content, pout_len); +rtw_set_ie (out_ie + *pout_len, EID_EXTCapability,8 , cap_content, pout_len); }inline void rtw_set_to_roam (struct adapter *adapter,u8 to_roam)
Signature · 1 line
2.21.1