All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable
@ 2021-03-27  0:17 Edmundo Carmona Antoranz
  2021-03-27  0:17 ` [PATCH -next 2/6] staging: rtl8723bs: mlme: remove unused variables Edmundo Carmona Antoranz
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:17 UTC (permalink / raw)
  To: gregkh, marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging
  Cc: kernel-janitors, Edmundo Carmona Antoranz

sec_idx in rtw_get_sec_ie() is set to 0 and never changes value. Also,
it is only used for debugging messages. Therefore the variable is
removed and the debug messages are adjusted. Adjusting debug messages
forced style changes. Taking the opportunity to adjust indentation
of those sections of the code.

Removing this warning:

drivers/staging/rtl8723bs/core/rtw_ieee80211.c:657:15: warning: variable ‘sec_idx’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c    | 43 +++++++++++--------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index cccbea555a32..ec065d924fbb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -654,7 +654,7 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len)
 
 void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie, u16 *wpa_len)
 {
-	u8 authmode, sec_idx, i;
+	u8 authmode, i;
 	u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
 	uint	cnt;
 
@@ -662,37 +662,44 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie
 
 	cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
 
-	sec_idx = 0;
-
 	while (cnt < in_len) {
 		authmode = in_ie[cnt];
 
 		if ((authmode == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&in_ie[cnt+2], &wpa_oui[0], 4))) {
-				RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n rtw_get_wpa_ie: sec_idx =%d in_ie[cnt+1]+2 =%d\n", sec_idx, in_ie[cnt+1]+2));
+			RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
+				 ("\n rtw_get_wpa_ie: in_ie[cnt+1]+2 =%d\n", in_ie[cnt + 1] + 2));
 
-				if (wpa_ie) {
+			if (wpa_ie) {
 				memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt+1]+2);
 
 				for (i = 0; i < (in_ie[cnt+1]+2); i = i+8) {
-						RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n %2x,%2x,%2x,%2x,%2x,%2x,%2x,%2x\n",
-									wpa_ie[i], wpa_ie[i+1], wpa_ie[i+2], wpa_ie[i+3], wpa_ie[i+4],
-									wpa_ie[i+5], wpa_ie[i+6], wpa_ie[i+7]));
-					}
+					RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
+						 ("\n %2x,%2x,%2x,%2x,%2x,%2x,%2x,%2x\n",
+						  wpa_ie[i], wpa_ie[i + 1], wpa_ie[i + 2],
+						  wpa_ie[i + 3], wpa_ie[i + 4],
+						  wpa_ie[i + 5], wpa_ie[i + 6],
+						  wpa_ie[i + 7]));
 				}
+			}
 
-				*wpa_len = in_ie[cnt+1]+2;
-				cnt += in_ie[cnt+1]+2;  /* get next */
+			*wpa_len = in_ie[cnt + 1] + 2;
+			cnt += in_ie[cnt + 1] + 2;  /* get next */
 		} else {
 			if (authmode == WLAN_EID_RSN) {
-				RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n get_rsn_ie: sec_idx =%d in_ie[cnt+1]+2 =%d\n", sec_idx, in_ie[cnt+1]+2));
+				RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
+					 ("\n get_rsn_ie: in_ie[cnt+1]+2 =%d\n",
+					  in_ie[cnt + 1] + 2));
 
 				if (rsn_ie) {
-				memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt+1]+2);
-
-				for (i = 0; i < (in_ie[cnt+1]+2); i = i+8) {
-						RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n %2x,%2x,%2x,%2x,%2x,%2x,%2x,%2x\n",
-									rsn_ie[i], rsn_ie[i+1], rsn_ie[i+2], rsn_ie[i+3], rsn_ie[i+4],
-									rsn_ie[i+5], rsn_ie[i+6], rsn_ie[i+7]));
+					memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
+
+					for (i = 0; i < (in_ie[cnt + 1] + 2); i = i + 8) {
+						RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
+							 ("\n %2x,%2x,%2x,%2x,%2x,%2x,%2x,%2x\n",
+							  rsn_ie[i], rsn_ie[i + 1], rsn_ie[i + 2],
+							  rsn_ie[i + 3], rsn_ie[i + 4],
+							  rsn_ie[i + 5], rsn_ie[i + 6],
+							  rsn_ie[i + 7]));
 					}
 				}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH -next 2/6] staging: rtl8723bs: mlme: remove unused variables
  2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
@ 2021-03-27  0:17 ` Edmundo Carmona Antoranz
  2021-03-28 12:33   ` Greg KH
  2021-03-27  0:17 ` [PATCH -next 3/6] staging: rtl8723bs: hal: remove unused variable in HalBtc8723b1Ant.c Edmundo Carmona Antoranz
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:17 UTC (permalink / raw)
  To: gregkh, marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging
  Cc: kernel-janitors, Edmundo Carmona Antoranz

The variable *pframe in rtw_build_wmm_ie_ht() and rtw_restructure_ht_ie()
is set but never read. Both instances are getting removed.

Removing these warning:

drivers/staging/rtl8723bs/core/rtw_mlme.c:2560:6: warning: variable ‘pframe’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_mlme.c:2576:21: warning: variable ‘pframe’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 29d4b7493784..83fbd415d766 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -2555,12 +2555,11 @@ void rtw_build_wmm_ie_ht(struct adapter *padapter, u8 *out_ie, uint *pout_len)
 {
 	unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00};
 	int out_len;
-	u8 *pframe;
 
 	if (padapter->mlmepriv.qospriv.qos_option == 0) {
 		out_len = *pout_len;
-		pframe = rtw_set_ie(out_ie+out_len, WLAN_EID_VENDOR_SPECIFIC,
-							_WMM_IE_Length_, WMM_IE, pout_len);
+		rtw_set_ie(out_ie + out_len, WLAN_EID_VENDOR_SPECIFIC,
+			   _WMM_IE_Length_, WMM_IE, pout_len);
 
 		padapter->mlmepriv.qospriv.qos_option = 1;
 	}
@@ -2571,7 +2570,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
 {
 	u32 ielen, out_len;
 	enum ieee80211_max_ampdu_length_exp max_rx_ampdu_factor;
-	unsigned char *p, *pframe;
+	unsigned char *p;
 	struct ieee80211_ht_cap ht_capie;
 	u8 cbw40_enable = 0, stbc_rx_enable = 0, rf_type = 0, operation_bw = 0;
 	struct registry_priv *pregistrypriv = &padapter->registrypriv;
@@ -2696,8 +2695,8 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
 	else
 		ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00);
 
-	pframe = rtw_set_ie(out_ie+out_len, WLAN_EID_HT_CAPABILITY,
-						sizeof(struct ieee80211_ht_cap), (unsigned char *)&ht_capie, pout_len);
+	rtw_set_ie(out_ie + out_len, WLAN_EID_HT_CAPABILITY,
+		   sizeof(struct ieee80211_ht_cap), (unsigned char *)&ht_capie, pout_len);
 
 	phtpriv->ht_option = true;
 
@@ -2705,7 +2704,8 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
 		p = rtw_get_ie(in_ie, WLAN_EID_HT_OPERATION, &ielen, in_len);
 		if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) {
 			out_len = *pout_len;
-			pframe = rtw_set_ie(out_ie+out_len, WLAN_EID_HT_OPERATION, ielen, p+2, pout_len);
+			rtw_set_ie(out_ie + out_len, WLAN_EID_HT_OPERATION,
+				   ielen, p + 2, pout_len);
 		}
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH -next 3/6] staging: rtl8723bs: hal: remove unused variable in HalBtc8723b1Ant.c
  2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
  2021-03-27  0:17 ` [PATCH -next 2/6] staging: rtl8723bs: mlme: remove unused variables Edmundo Carmona Antoranz
@ 2021-03-27  0:17 ` Edmundo Carmona Antoranz
  2021-03-27  0:17 ` [PATCH -next 4/6] staging: rtl8723bs: sdio_ops: removing unused variable Edmundo Carmona Antoranz
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:17 UTC (permalink / raw)
  To: gregkh, marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging
  Cc: kernel-janitors, Edmundo Carmona Antoranz

Variable btRssiState in halbtc8723b1ant_ActionWifiConnectedBtAclBusy()
is set but never read. Removing it.

Removing this warning:

drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c:2093:5: warning: variable ‘btRssiState’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
---
 drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index 621f8181f46d..3e794093092b 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -2090,10 +2090,8 @@ static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy(
 	struct btc_coexist *pBtCoexist, u8 wifiStatus
 )
 {
-	u8 btRssiState;
-
 	struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo;
-	btRssiState = halbtc8723b1ant_BtRssiState(2, 28, 0);
+	halbtc8723b1ant_BtRssiState(2, 28, 0);
 
 	if ((pCoexSta->lowPriorityRx >= 1000) && (pCoexSta->lowPriorityRx != 65535))
 		pBtLinkInfo->bSlaveRole = true;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH -next 4/6] staging: rtl8723bs: sdio_ops: removing unused variable
  2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
  2021-03-27  0:17 ` [PATCH -next 2/6] staging: rtl8723bs: mlme: remove unused variables Edmundo Carmona Antoranz
  2021-03-27  0:17 ` [PATCH -next 3/6] staging: rtl8723bs: hal: remove unused variable in HalBtc8723b1Ant.c Edmundo Carmona Antoranz
@ 2021-03-27  0:17 ` Edmundo Carmona Antoranz
  2021-03-27  0:17 ` [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused Edmundo Carmona Antoranz
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:17 UTC (permalink / raw)
  To: gregkh, marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging
  Cc: kernel-janitors, Edmundo Carmona Antoranz

Inside sd_int_dpc(), variable report is set but it's never read.
Getting rid of it.

Removing this warning:

drivers/staging/rtl8723bs/hal/sdio_ops.c:946:30: warning: variable ‘report’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 170a28f4b191..a24a39e70454 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -943,11 +943,9 @@ void sd_int_dpc(struct adapter *adapter)
 	}
 
 	if (hal->sdio_hisr & SDIO_HISR_CPWM1) {
-		struct reportpwrstate_parm report;
-
 		del_timer_sync(&(pwrctl->pwr_rpwm_timer));
 
-		report.state = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_HCPWM1_8723B);
+		SdioLocalCmd52Read1Byte(adapter, SDIO_REG_HCPWM1_8723B);
 
 		_set_workitem(&(pwrctl->cpwm_event));
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused
  2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
                   ` (2 preceding siblings ...)
  2021-03-27  0:17 ` [PATCH -next 4/6] staging: rtl8723bs: sdio_ops: removing unused variable Edmundo Carmona Antoranz
@ 2021-03-27  0:17 ` Edmundo Carmona Antoranz
  2021-03-27  8:17   ` Dan Carpenter
  2021-03-27  0:17 ` [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error Edmundo Carmona Antoranz
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:17 UTC (permalink / raw)
  To: gregkh, marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging
  Cc: kernel-janitors, Edmundo Carmona Antoranz

The definition of a few macros used in the code to write debug
messages could be empty depending on the way code is compiled.
If this is the case, there are compiler warnings about variables
not being used. This patch markes them to be __maybe_unused to
avoid these warnings.

Removing these warnings:

drivers/staging/rtl8723bs/core/rtw_mlme.c:1282:12: warning: variable ‘retry’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1065:17: warning: variable ‘reassoc’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1799:30: warning: variable ‘reason_code’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:5411:21: warning: variable ‘psta’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:6317:15: warning: variable ‘evt_seq’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_recv.c:2501:6: warning: variable ‘num_signal_qual’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_wlan_util.c:1793:11: warning: variable ‘start_seq’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:3719:32: warning: variable ‘ioted’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:3719:20: warning: variable ‘masked’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:3719:7: warning: variable ‘input_b’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:4290:46: warning: variable ‘lowest_rate’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:4290:34: warning: variable ‘hight_rate’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:4290:21: warning: variable ‘curr_tx_sgi’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:4290:7: warning: variable ‘curr_tx_rate’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:4289:20: warning: variable ‘rate_mask2’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:4289:8: warning: variable ‘rate_mask1’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/hal/sdio_ops.c:170:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2924:7: warning: variable ‘ack’ set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:1199:6: warning: variable ‘reason’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c         |  2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c     | 11 +++++++----
 drivers/staging/rtl8723bs/core/rtw_recv.c         |  2 +-
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c    |  3 ++-
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c |  7 ++++---
 drivers/staging/rtl8723bs/hal/sdio_ops.c          |  2 +-
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c |  2 +-
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c    |  2 +-
 8 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 83fbd415d766..5125a7ec0198 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1277,7 +1277,7 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net
 /* define REJOIN */
 void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
 {
-	static u8 retry;
+	static u8 __maybe_unused retry;
 	struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL;
 	struct	sta_priv *pstapriv = &adapter->stapriv;
 	struct	mlme_priv *pmlmepriv = &(adapter->mlmepriv);
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 8aadcf72a7ba..4795d35bd99b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1062,7 +1062,8 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 	u16 capab_info;
 	struct rtw_ieee802_11_elems elems;
 	struct sta_info *pstat;
-	unsigned char 	reassoc, *p, *pos, *wpa_ie;
+	unsigned char *p, *pos, *wpa_ie;
+	unsigned char __maybe_unused reassoc;
 	unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01};
 	int		i, ie_len, wpa_ie_len, left;
 	unsigned char 	supportRate[16];
@@ -1796,7 +1797,8 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra
 	struct recv_reorder_ctrl *preorder_ctrl;
 	unsigned char 	*frame_body;
 	unsigned char 	category, action;
-	unsigned short	tid, status, reason_code = 0;
+	unsigned short	tid, status;
+	unsigned short __maybe_unused reason_code = 0;
 	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
 	struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
 	u8 *pframe = precv_frame->u.hdr.rx_data;
@@ -5408,7 +5410,7 @@ void _linked_info_dump(struct adapter *padapter)
 		} else if ((pmlmeinfo->state&0x03) == _HW_STATE_AP_) {
 			struct list_head	*phead, *plist;
 
-			struct sta_info *psta = NULL;
+			struct sta_info __maybe_unused *psta = NULL;
 			struct sta_priv *pstapriv = &padapter->stapriv;
 
 			spin_lock_bh(&pstapriv->asoc_list_lock);
@@ -6314,7 +6316,8 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
 
 u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 {
-	u8 evt_code, evt_seq;
+	u8 evt_code;
+	u8 __maybe_unused evt_seq;
 	u16 evt_sz;
 	uint	*peventbuf;
 	void (*event_callback)(struct adapter *dev, u8 *pbuf);
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 608a59286505..9e6c229cae8d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -2471,7 +2471,7 @@ static void rtw_signal_stat_timer_hdl(struct timer_list *t)
 	u8 avg_signal_strength = 0;
 	u8 avg_signal_qual = 0;
 	u32 num_signal_strength = 0;
-	u32 num_signal_qual = 0;
+	u32 __maybe_unused num_signal_qual = 0;
 	u8 _alpha = 5; /*  this value is based on converging_constant = 5000 and sampling_interval = 1000 */
 
 	if (adapter->recvpriv.is_signal_dbg) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 760b0ea4e9bd..39f423ee4cf1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1787,7 +1787,8 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr)
 {
 	struct sta_info *psta;
-	u16 tid, start_seq, param;
+	u16 tid, param;
+	u16 __maybe_unused start_seq;
 	struct recv_reorder_ctrl *preorder_ctrl;
 	struct sta_priv *pstapriv = &padapter->stapriv;
 	struct ADDBA_request *preq = (struct ADDBA_request *)paddba_req;
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 0081fe0a431f..1b54d8527823 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -3716,7 +3716,8 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val)
 	case HW_VAR_BASIC_RATE:
 	{
 		struct mlme_ext_info *mlmext_info = &padapter->mlmeextpriv.mlmext_info;
-		u16 input_b = 0, masked = 0, ioted = 0, BrateCfg = 0;
+		u16 __maybe_unused input_b = 0, masked = 0, ioted = 0;
+		u16 BrateCfg = 0;
 		u16 rrsr_2g_force_mask = (RRSR_11M|RRSR_5_5M|RRSR_1M);
 		u16 rrsr_2g_allow_mask = (RRSR_24M|RRSR_12M|RRSR_6M|RRSR_CCK_RATES);
 
@@ -4286,8 +4287,8 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, v
 			u8 mac_id = *(u8 *)pval;
 			u32 cmd;
 			u32 ra_info1, ra_info2;
-			u32 rate_mask1, rate_mask2;
-			u8 curr_tx_rate, curr_tx_sgi, hight_rate, lowest_rate;
+			u32 __maybe_unused rate_mask1, rate_mask2;
+			u8 __maybe_unused curr_tx_rate, curr_tx_sgi, hight_rate, lowest_rate;
 
 			DBG_8192C("============ RA status check  Mac_id:%d ===================\n", mac_id);
 
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index a24a39e70454..39328217a9c6 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -167,7 +167,7 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr)
 	u32 ftaddr;
 	u8 shift;
 	u32 val;
-	s32 err;
+	s32 __maybe_unused err;
 	__le32 le_tmp;
 
 	adapter = intfhdl->padapter;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 03a784558d79..c342fdebb6a7 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -2919,7 +2919,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
 	struct pkt_attrib	*pattrib;
 	unsigned char *pframe;
 	int ret = _FAIL;
-	bool ack = true;
+	bool __maybe_unused ack = true;
 	struct ieee80211_hdr *pwlanhdr;
 	struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
 	struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 9909dece0b01..322a9393621e 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -1196,7 +1196,7 @@ static int rtw_wx_set_mlme(struct net_device *dev,
 			     union iwreq_data *wrqu, char *extra)
 {
 	int ret = 0;
-	u16 reason;
+	u16 __maybe_unused reason;
 	struct adapter *padapter = rtw_netdev_priv(dev);
 	struct iw_mlme *mlme = (struct iw_mlme *)extra;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error
  2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
                   ` (3 preceding siblings ...)
  2021-03-27  0:17 ` [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused Edmundo Carmona Antoranz
@ 2021-03-27  0:17 ` Edmundo Carmona Antoranz
  2021-03-27  0:23     ` Edmundo Carmona Antoranz
  2021-03-27  8:21   ` Dan Carpenter
  2021-03-27  8:13 ` [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Dan Carpenter
  2021-03-28 12:32 ` Greg KH
  6 siblings, 2 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:17 UTC (permalink / raw)
  To: gregkh, marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging
  Cc: kernel-janitors, Edmundo Carmona Antoranz

If there is an error when calling rtw_init_bcmc_stainfo() inside
rtw_init_bcmc_stainfo(), variable res is set to _FAIL. However, when
returning, _SUCCESS is always returned regardless. Just in case,
all existing calls do not consider the result of the function.

Compile-tested as I don't have the hardware.

Removing this warning:

drivers/staging/rtl8723bs/core/rtw_sta_mgt.c:536:6: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index f96dd0b40e04..7b578192adf5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -551,7 +551,7 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
 	psta->mac_id = 1;
 
 exit:
-	return _SUCCESS;
+	return res;
 }
 
 struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error
  2021-03-27  0:17 ` [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error Edmundo Carmona Antoranz
@ 2021-03-27  0:23     ` Edmundo Carmona Antoranz
  2021-03-27  8:21   ` Dan Carpenter
  1 sibling, 0 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marco Cesati, Dan Carpenter, Ross Schmidt,
	fabioaiuto83, linux-staging
  Cc: kernel-janitors

On Fri, Mar 26, 2021 at 6:18 PM Edmundo Carmona Antoranz
<eantoranz@gmail.com> wrote:
>
> If there is an error when calling rtw_init_bcmc_stainfo() inside
> rtw_init_bcmc_stainfo(), variable res is set to _FAIL. However, when


I must have been half-asleep when I was writing that. :-D Sorry. I
don't think it's that bad that it should be taken back, though.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error
@ 2021-03-27  0:23     ` Edmundo Carmona Antoranz
  0 siblings, 0 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27  0:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marco Cesati, Dan Carpenter, Ross Schmidt,
	fabioaiuto83, linux-staging
  Cc: kernel-janitors

On Fri, Mar 26, 2021 at 6:18 PM Edmundo Carmona Antoranz
<eantoranz@gmail.com> wrote:
>
> If there is an error when calling rtw_init_bcmc_stainfo() inside
> rtw_init_bcmc_stainfo(), variable res is set to _FAIL. However, when


I must have been half-asleep when I was writing that. :-D Sorry. I
don't think it's that bad that it should be taken back, though.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable
  2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
                   ` (4 preceding siblings ...)
  2021-03-27  0:17 ` [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error Edmundo Carmona Antoranz
@ 2021-03-27  8:13 ` Dan Carpenter
  2021-03-28 12:32 ` Greg KH
  6 siblings, 0 replies; 16+ messages in thread
From: Dan Carpenter @ 2021-03-27  8:13 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz
  Cc: gregkh, marcocesati, ross.schm.dev, fabioaiuto83, linux-staging,
	kernel-janitors

On Fri, Mar 26, 2021 at 06:17:31PM -0600, Edmundo Carmona Antoranz wrote:
> sec_idx in rtw_get_sec_ie() is set to 0 and never changes value. Also,
> it is only used for debugging messages. Therefore the variable is
> removed and the debug messages are adjusted. Adjusting debug messages
> forced style changes. Taking the opportunity to adjust indentation
> of those sections of the code.

The re-indents are not related to the other change so you're going to
have to split this up into two different patches.

Generally you're making a whitespace change on the same line as the code
you are changing then that's fine.  But sometimes re-indenting it makes
the change harder to spot (review).  I would say that this code is
easier to review without any indenting changes:

ONE:

-				RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n rtw_get_wpa_ie: sec_idx =%d in_ie[cnt+1]+2 =%d\n", sec_idx, in_ie[cnt+1]+2));
+				RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n rtw_get_wpa_ie: in_ie[cnt+1]+2 =%d\n", in_ie[cnt+1]+2));


TWO:

-				RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n rtw_get_wpa_ie: sec_idx =%d in_ie[cnt+1]+2 =%d\n", sec_idx, in_ie[cnt+1]+2));
+			RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
+				 ("\n rtw_get_wpa_ie: in_ie[cnt+1]+2 =%d\n", in_ie[cnt + 1] + 2));

>  				memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt+1]+2);
>  
>  				for (i = 0; i < (in_ie[cnt+1]+2); i = i+8) {
> -						RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n %2x,%2x,%2x,%2x,%2x,%2x,%2x,%2x\n",
> -									wpa_ie[i], wpa_ie[i+1], wpa_ie[i+2], wpa_ie[i+3], wpa_ie[i+4],
> -									wpa_ie[i+5], wpa_ie[i+6], wpa_ie[i+7]));
> -					}
> +					RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
> +						 ("\n %2x,%2x,%2x,%2x,%2x,%2x,%2x,%2x\n",
> +						  wpa_ie[i], wpa_ie[i + 1], wpa_ie[i + 2],
> +						  wpa_ie[i + 3], wpa_ie[i + 4],
> +						  wpa_ie[i + 5], wpa_ie[i + 6],
> +						  wpa_ie[i + 7]));

In this case, the curly braces were fine in the original.  Multi-line
indented normally get curly braces for readability.

>  				}
> +			}
>  

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused
  2021-03-27  0:17 ` [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused Edmundo Carmona Antoranz
@ 2021-03-27  8:17   ` Dan Carpenter
  2021-03-27 14:44       ` Edmundo Carmona Antoranz
  0 siblings, 1 reply; 16+ messages in thread
From: Dan Carpenter @ 2021-03-27  8:17 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz
  Cc: gregkh, marcocesati, ross.schm.dev, fabioaiuto83, linux-staging,
	kernel-janitors

This is just papering over badness.  Leave the warnings as is so someone
will notice it and fix it properly in the future.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error
  2021-03-27  0:17 ` [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error Edmundo Carmona Antoranz
  2021-03-27  0:23     ` Edmundo Carmona Antoranz
@ 2021-03-27  8:21   ` Dan Carpenter
  1 sibling, 0 replies; 16+ messages in thread
From: Dan Carpenter @ 2021-03-27  8:21 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz
  Cc: gregkh, marcocesati, ross.schm.dev, fabioaiuto83, linux-staging,
	kernel-janitors

On Fri, Mar 26, 2021 at 06:17:36PM -0600, Edmundo Carmona Antoranz wrote:
> If there is an error when calling rtw_init_bcmc_stainfo() inside
> rtw_init_bcmc_stainfo(), variable res is set to _FAIL. However, when
> returning, _SUCCESS is always returned regardless. Just in case,
> all existing calls do not consider the result of the function.

This more papering over badness.  Lets leave it as-is until someone can
fix the callers.  Static checkers are useful things but if we silence
the warnings without fixing the bugs then we are basically going to
great effort to write a checker and even more effort to disable the
checker.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused
  2021-03-27  8:17   ` Dan Carpenter
@ 2021-03-27 14:44       ` Edmundo Carmona Antoranz
  0 siblings, 0 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27 14:44 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, Marco Cesati, Ross Schmidt, fabioaiuto83,
	linux-staging, kernel-janitors

On Sat, Mar 27, 2021 at 2:18 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> This is just papering over badness.  Leave the warnings as is so someone
> will notice it and fix it properly in the future.
>

Interesting.... I wonder what the right way to handle this would be
then. Is it a more appropriate solution defining the debug macros
_only_ if we are debugging and then also use #ifs in code to define
the variables and handle them?

So, currently, in rtw_debug.h, we have this (lines ~134-140):

#define RT_TRACE(_Comp, _Level, Fmt) do {} while (0)
#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData,
_HexDataLen) do {} while (0)

#define DBG_871X(x, ...) do {} while (0)
#define MSG_8192C(x, ...) do {} while (0)
#define DBG_8192C(x, ...) do {} while (0)
#define DBG_871X_LEVEL(x, ...) do {} while (0)


And then, a bit further down the road in the same file:
#ifdef DEBUG
#if defined(_dbgdump)
    #undef DBG_871X
    #define DBG_871X(...)     do {\
        _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
    } while (0)

    #undef MSG_8192C
    #define MSG_8192C(...)     do {\
        _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
    } while (0)

    #undef DBG_8192C
    #define DBG_8192C(...)     do {\
        _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
    } while (0)
#endif /* defined(_dbgdump) */
#endif /* DEBUG */

If we remove the definition of the macros that were around line 134,
we need to make sure that those macros are not used in code if the
same conditions are not met... so, it might mean that we control if we
define the variables we are using... one of the examples from this
patch:


    unsigned char *p, *pos, *wpa_ie;
#ifdef DEBUG && defined(_dbgdump)
    unsigned char * reassoc;
#endif
    unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01};
.
.
.
    if (frame_type == WIFI_ASSOCREQ) {
#ifdef DEBUG && defined(_dbgdump)
        reassoc = 0;
#endif
        ie_offset = _ASOCREQ_IE_OFFSET_;
    } else { /*  WIFI_REASSOCREQ */
#ifdef DEBUG && defined(_dbgdump)
        reassoc = 1;
#endif
        ie_offset = _REASOCREQ_IE_OFFSET_;
    }

    if (pkt_len < sizeof(struct ieee80211_hdr_3addr) + ie_offset) {
#ifdef DEBUG && defined(_dbgdump)
        DBG_871X("handle_assoc(reassoc =%d) - too short payload (len =%lu)"
             "\n", reassoc, (unsigned long)pkt_len);
#endif
        return _FAIL;
    }

> regards,
> dan carpenter
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused
@ 2021-03-27 14:44       ` Edmundo Carmona Antoranz
  0 siblings, 0 replies; 16+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-27 14:44 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, Marco Cesati, Ross Schmidt, fabioaiuto83,
	linux-staging, kernel-janitors

On Sat, Mar 27, 2021 at 2:18 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> This is just papering over badness.  Leave the warnings as is so someone
> will notice it and fix it properly in the future.
>

Interesting.... I wonder what the right way to handle this would be
then. Is it a more appropriate solution defining the debug macros
_only_ if we are debugging and then also use #ifs in code to define
the variables and handle them?

So, currently, in rtw_debug.h, we have this (lines ~134-140):

#define RT_TRACE(_Comp, _Level, Fmt) do {} while (0)
#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData,
_HexDataLen) do {} while (0)

#define DBG_871X(x, ...) do {} while (0)
#define MSG_8192C(x, ...) do {} while (0)
#define DBG_8192C(x, ...) do {} while (0)
#define DBG_871X_LEVEL(x, ...) do {} while (0)


And then, a bit further down the road in the same file:
#ifdef DEBUG
#if defined(_dbgdump)
    #undef DBG_871X
    #define DBG_871X(...)     do {\
        _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
    } while (0)

    #undef MSG_8192C
    #define MSG_8192C(...)     do {\
        _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
    } while (0)

    #undef DBG_8192C
    #define DBG_8192C(...)     do {\
        _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
    } while (0)
#endif /* defined(_dbgdump) */
#endif /* DEBUG */

If we remove the definition of the macros that were around line 134,
we need to make sure that those macros are not used in code if the
same conditions are not met... so, it might mean that we control if we
define the variables we are using... one of the examples from this
patch:


    unsigned char *p, *pos, *wpa_ie;
#ifdef DEBUG && defined(_dbgdump)
    unsigned char * reassoc;
#endif
    unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01};
.
.
.
    if (frame_type == WIFI_ASSOCREQ) {
#ifdef DEBUG && defined(_dbgdump)
        reassoc = 0;
#endif
        ie_offset = _ASOCREQ_IE_OFFSET_;
    } else { /*  WIFI_REASSOCREQ */
#ifdef DEBUG && defined(_dbgdump)
        reassoc = 1;
#endif
        ie_offset = _REASOCREQ_IE_OFFSET_;
    }

    if (pkt_len < sizeof(struct ieee80211_hdr_3addr) + ie_offset) {
#ifdef DEBUG && defined(_dbgdump)
        DBG_871X("handle_assoc(reassoc =%d) - too short payload (len =%lu)"
             "\n", reassoc, (unsigned long)pkt_len);
#endif
        return _FAIL;
    }

> regards,
> dan carpenter
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused
  2021-03-27 14:44       ` Edmundo Carmona Antoranz
  (?)
@ 2021-03-27 16:27       ` Dan Carpenter
  -1 siblings, 0 replies; 16+ messages in thread
From: Dan Carpenter @ 2021-03-27 16:27 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz
  Cc: Greg Kroah-Hartman, Marco Cesati, Ross Schmidt, fabioaiuto83,
	linux-staging, kernel-janitors

On Sat, Mar 27, 2021 at 08:44:29AM -0600, Edmundo Carmona Antoranz wrote:
> On Sat, Mar 27, 2021 at 2:18 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > This is just papering over badness.  Leave the warnings as is so someone
> > will notice it and fix it properly in the future.
> >

Take a look at the first example:

  1277  /* define REJOIN */
           ^^^^^^^^^^^^^
This is developer code which can't be turned on through the Kconfig.
Automatically that means we are allowed to delete all the #ifdef REJOIN
code.

  1278  void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
  1279  {
  1280          static u8 retry;
                ^^^^^^^^^^^^^^^

  1397          } else {/* if join_res < 0 (join fails), then try again */
  1398  
  1399                  #ifdef REJOIN
  1400                  res = _FAIL;
  1401                  if (retry < 2) {

This function is now only allowed to be called twice.  What the heck
sort of function is that where we can only call it twice???  Who calls
this anyway?  Something to investigate.

  1402                          res = rtw_select_and_join_from_scanned_queue(pmlmepriv);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Here we are setting "res".

  1403                          RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("rtw_select_and_join_from_scanned_queue again! res:%d\n", res));
  1404                  }
  1405  
  1406                  if (res == _SUCCESS) {
  1407                          /* extend time of assoc_timer */
  1408                          _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT);
  1409                          retry++;

So, okay, we're only allowed to succeed twice.  We can fail as many
times as we want.  Weird.


  1410                  } else if (res == 2) {/* there is no need to wait for join */

What does 1 is _SUCCESS, 0 is failure, but what is 2?  It turns out that
rtw_select_and_join_from_scanned_queue() never returns 2...

  1411                          _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
  1412                          rtw_indicate_connect(adapter);
  1413                  } else {
  1414                          RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Set Assoc_Timer = 1; can't find match ssid in scanned_q\n"));
  1415                  #endif
  1416  
  1417                          _set_timer(&pmlmepriv->assoc_timer, 1);
  1418                          /* rtw_free_assoc_resources(adapter, 1); */
  1419                          _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
  1420  
  1421                  #ifdef REJOIN
  1422                          retry = 0;
  1423                  }
  1424                  #endif
  1425          }
  1426  
  1427  ignore_joinbss_callback:
  1428  
  1429          spin_unlock_bh(&pmlmepriv->lock);
  1430  }

So a lot of this is nonsensical dead code, and the "unused variable" was
a useful clue about that.  Probably all these are nonsensical in their
own way so there isn't going to be one answer.  Look carefully at each
warning and then think about how to re-write it completely.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable
  2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
                   ` (5 preceding siblings ...)
  2021-03-27  8:13 ` [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Dan Carpenter
@ 2021-03-28 12:32 ` Greg KH
  6 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2021-03-28 12:32 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz
  Cc: marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging, kernel-janitors

On Fri, Mar 26, 2021 at 06:17:31PM -0600, Edmundo Carmona Antoranz wrote:
> sec_idx in rtw_get_sec_ie() is set to 0 and never changes value. Also,
> it is only used for debugging messages. Therefore the variable is
> removed and the debug messages are adjusted. Adjusting debug messages
> forced style changes. Taking the opportunity to adjust indentation
> of those sections of the code.
> 
> Removing this warning:
> 
> drivers/staging/rtl8723bs/core/rtw_ieee80211.c:657:15: warning: variable ‘sec_idx’ set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
> ---
>  .../staging/rtl8723bs/core/rtw_ieee80211.c    | 43 +++++++++++--------
>  1 file changed, 25 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
> index cccbea555a32..ec065d924fbb 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
> @@ -654,7 +654,7 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len)
>  
>  void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie, u16 *wpa_len)
>  {
> -	u8 authmode, sec_idx, i;
> +	u8 authmode, i;
>  	u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
>  	uint	cnt;
>  
> @@ -662,37 +662,44 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie
>  
>  	cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
>  
> -	sec_idx = 0;
> -
>  	while (cnt < in_len) {
>  		authmode = in_ie[cnt];
>  
>  		if ((authmode == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&in_ie[cnt+2], &wpa_oui[0], 4))) {
> -				RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n rtw_get_wpa_ie: sec_idx =%d in_ie[cnt+1]+2 =%d\n", sec_idx, in_ie[cnt+1]+2));
> +			RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
> +				 ("\n rtw_get_wpa_ie: in_ie[cnt+1]+2 =%d\n", in_ie[cnt + 1] + 2));

These "RT_TRACE" things need to all be removed or use the real in-kernel
api instead.  Please do not hide the problems with them by trying to
clean them up.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 2/6] staging: rtl8723bs: mlme: remove unused variables
  2021-03-27  0:17 ` [PATCH -next 2/6] staging: rtl8723bs: mlme: remove unused variables Edmundo Carmona Antoranz
@ 2021-03-28 12:33   ` Greg KH
  0 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2021-03-28 12:33 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz
  Cc: marcocesati, dan.carpenter, ross.schm.dev, fabioaiuto83,
	linux-staging, kernel-janitors

On Fri, Mar 26, 2021 at 06:17:32PM -0600, Edmundo Carmona Antoranz wrote:
> The variable *pframe in rtw_build_wmm_ie_ht() and rtw_restructure_ht_ie()
> is set but never read. Both instances are getting removed.
> 
> Removing these warning:
> 
> drivers/staging/rtl8723bs/core/rtw_mlme.c:2560:6: warning: variable ‘pframe’ set but not used [-Wunused-but-set-variable]
> drivers/staging/rtl8723bs/core/rtw_mlme.c:2576:21: warning: variable ‘pframe’ set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> index 29d4b7493784..83fbd415d766 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> @@ -2555,12 +2555,11 @@ void rtw_build_wmm_ie_ht(struct adapter *padapter, u8 *out_ie, uint *pout_len)
>  {
>  	unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00};
>  	int out_len;
> -	u8 *pframe;
>  
>  	if (padapter->mlmepriv.qospriv.qos_option == 0) {
>  		out_len = *pout_len;
> -		pframe = rtw_set_ie(out_ie+out_len, WLAN_EID_VENDOR_SPECIFIC,
> -							_WMM_IE_Length_, WMM_IE, pout_len);
> +		rtw_set_ie(out_ie + out_len, WLAN_EID_VENDOR_SPECIFIC,
> +			   _WMM_IE_Length_, WMM_IE, pout_len);

Why not check the error value?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-03-28 12:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27  0:17 [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Edmundo Carmona Antoranz
2021-03-27  0:17 ` [PATCH -next 2/6] staging: rtl8723bs: mlme: remove unused variables Edmundo Carmona Antoranz
2021-03-28 12:33   ` Greg KH
2021-03-27  0:17 ` [PATCH -next 3/6] staging: rtl8723bs: hal: remove unused variable in HalBtc8723b1Ant.c Edmundo Carmona Antoranz
2021-03-27  0:17 ` [PATCH -next 4/6] staging: rtl8723bs: sdio_ops: removing unused variable Edmundo Carmona Antoranz
2021-03-27  0:17 ` [PATCH -next 5/6] staging: rtl8723bs: mark some variables as __maybe_unused Edmundo Carmona Antoranz
2021-03-27  8:17   ` Dan Carpenter
2021-03-27 14:44     ` Edmundo Carmona Antoranz
2021-03-27 14:44       ` Edmundo Carmona Antoranz
2021-03-27 16:27       ` Dan Carpenter
2021-03-27  0:17 ` [PATCH -next 6/6] staging: rtl8723bs: sta_mgt: return _FAIL if there is an error Edmundo Carmona Antoranz
2021-03-27  0:23   ` Edmundo Carmona Antoranz
2021-03-27  0:23     ` Edmundo Carmona Antoranz
2021-03-27  8:21   ` Dan Carpenter
2021-03-27  8:13 ` [PATCH -next 1/6] staging: rtl8723bs: ieee80211: remove unused variable Dan Carpenter
2021-03-28 12:32 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.