2020-04-27 03:26:14

by Jason Yan

[permalink] [raw]
Subject: [PATCH 0/7] 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(-)

--
2.21.1


2020-04-27 03:26:22

by Jason Yan

[permalink] [raw]
Subject: [PATCH 5/7] staging: rtl8723bs: core: remove set but not used 'listen_interval'

Fix 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;
^~~~~~~~~~~~~~~

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 5adc3dad8d7c..d6d7198dfe45 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1169,7 +1169,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram

unsigned 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);
--
2.21.1

2020-04-27 03:26:28

by Jason Yan

[permalink] [raw]
Subject: [PATCH 2/7] staging: rtl8723bs: os_dep: remove set but not used 'size'

And 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;
^~~~

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(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1ba85a43f05a..b037868fbf22 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -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);
}

--
2.21.1

2020-04-27 03:27:19

by Jason Yan

[permalink] [raw]
Subject: [PATCH 6/7] staging: rtl8723bs: core: remove set but not used 'pwrpriv'

Fix 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;
^~~~~~~

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index d7a58af76ea0..abf60c92c1ac 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -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);
}
--
2.21.1

2020-04-27 03:27:52

by Jason Yan

[permalink] [raw]
Subject: [PATCH 4/7] staging: rtl8723bs: core: remove set but not used 'algthm'

Fix 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;
^~~~~~

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 8f9da1d49343..5adc3dad8d7c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -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));

--
2.21.1

2020-04-27 03:27:59

by Jason Yan

[permalink] [raw]
Subject: [PATCH 3/7] Staging: rtl8723bs: core: remove set but not used 'ptxservq'

Fix 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;
^~~~~~~~

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index 09d2ca30d653..e3f56c6cc882 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -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;
}
--
2.21.1

2020-04-27 03:29:29

by Jason Yan

[permalink] [raw]
Subject: [PATCH 7/7] staging: rtl8723bs: core: remove set but not used 'pframe'

Fix 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;
^~~~~~

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index abf60c92c1ac..e65c5a870b46 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -2914,12 +2914,11 @@ void rtw_append_exented_cap(struct adapter *padapter, u8 *out_ie, uint *pout_len
struct 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)
--
2.21.1

2020-04-28 12:31:23

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/7] staging: rtl8723bs: os_dep: remove set but not used 'size'

On Mon, Apr 27, 2020 at 11:23:37AM +0800, Jason Yan wrote:
> And 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;
> ^~~~
>
> 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(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 1ba85a43f05a..b037868fbf22 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -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);
> }

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

2020-04-28 12:42:16

by Jason Yan

[permalink] [raw]
Subject: Re: [PATCH 2/7] staging: rtl8723bs: os_dep: remove set but not used 'size'



在 2020/4/28 20:28, Greg KH 写道:
> On Mon, Apr 27, 2020 at 11:23:37AM +0800, Jason Yan wrote:
>> And 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;
>> ^~~~
>>
>> 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(-)
>>
>> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
>> index 1ba85a43f05a..b037868fbf22 100644
>> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
>> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
>> @@ -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);
>> }
>
> 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.

> thanks,
>
> greg k-h
>
> .
>