mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] staging: rtlwifi: base: Remove set but not used variables
@ 2019-04-06  3:12 YueHaibing
  2019-04-06  8:27 ` Mukesh Ojha
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-04-06  3:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Payal Kshirsagar, Sohil Ladhani,
	Cristian Sicilia, Luke Triantafyllidis, Nathan Chancellor,
	Luca Coelho
  Cc: YueHaibing, devel, linux-kernel, kernel-janitors

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/staging/rtlwifi/base.c: In function 'rtl_tx_agg_stop':
drivers/staging/rtlwifi/base.c:1733:23: warning:
 variable 'tid_data' set but not used [-Wunused-but-set-variable]

drivers/staging/rtlwifi/base.c: In function 'rtl_check_beacon_key':
drivers/staging/rtlwifi/base.c:2474:5: warning:
 variable 'ds_param_len' set but not used [-Wunused-but-set-variable]

drivers/staging/rtlwifi/base.c:2472:5: warning:
 variable 'ht_oper_len' set but not used [-Wunused-but-set-variable]

drivers/staging/rtlwifi/base.c:2470:5: warning:
 variable 'ht_cap_len' set but not used [-Wunused-but-set-variable]

They are never used and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/staging/rtlwifi/base.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index b8358ebbf912..b8b89e4c54d4 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -1730,7 +1730,6 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		    struct ieee80211_sta *sta, u16 tid)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_tid_data *tid_data;
 	struct rtl_sta_info *sta_entry = NULL;
 
 	if (!sta)
@@ -1743,7 +1742,6 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		return -EINVAL;
 
 	sta_entry = (struct rtl_sta_info *)sta->drv_priv;
-	tid_data = &sta_entry->tids[tid];
 	sta_entry->tids[tid].agg.agg_state = RTL_AGG_STOP;
 
 	ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
@@ -2467,11 +2465,8 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
 	struct rtl_beacon_keys bcn_key = {};
 	struct rtl_beacon_keys *cur_bcn_key;
 	u8 *ht_cap;
-	u8 ht_cap_len;
 	u8 *ht_oper;
-	u8 ht_oper_len;
 	u8 *ds_param;
-	u8 ds_param_len;
 
 	if (mac->opmode != NL80211_IFTYPE_STATION)
 		return false;
@@ -2502,18 +2497,15 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
 	/***** Parsing DS Param IE ******/
 	ds_param = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_DS_PARAMS);
 
-	if (ds_param && !(ds_param[1] < sizeof(*ds_param))) {
-		ds_param_len = ds_param[1];
+	if (ds_param && !(ds_param[1] < sizeof(*ds_param)))
 		bcn_key.bcn_channel = ds_param[2];
-	} else {
+	else
 		ds_param = NULL;
-	}
 
 	/***** Parsing HT Cap. IE ******/
 	ht_cap = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_HT_CAPABILITY);
 
 	if (ht_cap && !(ht_cap[1] < sizeof(*ht_cap))) {
-		ht_cap_len = ht_cap[1];
 		ht_cap_ie = (struct ieee80211_ht_cap *)&ht_cap[2];
 		bcn_key.ht_cap_info = ht_cap_ie->cap_info;
 	} else  {
@@ -2523,12 +2515,10 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
 	/***** Parsing HT Info. IE ******/
 	ht_oper = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_HT_OPERATION);
 
-	if (ht_oper && !(ht_oper[1] < sizeof(*ht_oper))) {
-		ht_oper_len = ht_oper[1];
+	if (ht_oper && !(ht_oper[1] < sizeof(*ht_oper)))
 		ht_oper_ie = (struct ieee80211_ht_operation *)&ht_oper[2];
-	} else {
+	else
 		ht_oper = NULL;
-	}
 
 	/* update bcn_key */
 






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

* Re: [PATCH -next] staging: rtlwifi: base: Remove set but not used variables
  2019-04-06  3:12 [PATCH -next] staging: rtlwifi: base: Remove set but not used variables YueHaibing
@ 2019-04-06  8:27 ` Mukesh Ojha
  0 siblings, 0 replies; 2+ messages in thread
From: Mukesh Ojha @ 2019-04-06  8:27 UTC (permalink / raw)
  To: YueHaibing, Greg Kroah-Hartman, Payal Kshirsagar, Sohil Ladhani,
	Cristian Sicilia, Luke Triantafyllidis, Nathan Chancellor,
	Luca Coelho
  Cc: devel, linux-kernel, kernel-janitors


On 4/6/2019 8:42 AM, YueHaibing wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/staging/rtlwifi/base.c: In function 'rtl_tx_agg_stop':
> drivers/staging/rtlwifi/base.c:1733:23: warning:
>   variable 'tid_data' set but not used [-Wunused-but-set-variable]
>
> drivers/staging/rtlwifi/base.c: In function 'rtl_check_beacon_key':
> drivers/staging/rtlwifi/base.c:2474:5: warning:
>   variable 'ds_param_len' set but not used [-Wunused-but-set-variable]
>
> drivers/staging/rtlwifi/base.c:2472:5: warning:
>   variable 'ht_oper_len' set but not used [-Wunused-but-set-variable]
>
> drivers/staging/rtlwifi/base.c:2470:5: warning:
>   variable 'ht_cap_len' set but not used [-Wunused-but-set-variable]
>
> They are never used and can be removed.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh

> ---
>   drivers/staging/rtlwifi/base.c | 18 ++++--------------
>   1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
> index b8358ebbf912..b8b89e4c54d4 100644
> --- a/drivers/staging/rtlwifi/base.c
> +++ b/drivers/staging/rtlwifi/base.c
> @@ -1730,7 +1730,6 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   		    struct ieee80211_sta *sta, u16 tid)
>   {
>   	struct rtl_priv *rtlpriv = rtl_priv(hw);
> -	struct rtl_tid_data *tid_data;
>   	struct rtl_sta_info *sta_entry = NULL;
>   
>   	if (!sta)
> @@ -1743,7 +1742,6 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   		return -EINVAL;
>   
>   	sta_entry = (struct rtl_sta_info *)sta->drv_priv;
> -	tid_data = &sta_entry->tids[tid];
>   	sta_entry->tids[tid].agg.agg_state = RTL_AGG_STOP;
>   
>   	ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
> @@ -2467,11 +2465,8 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
>   	struct rtl_beacon_keys bcn_key = {};
>   	struct rtl_beacon_keys *cur_bcn_key;
>   	u8 *ht_cap;
> -	u8 ht_cap_len;
>   	u8 *ht_oper;
> -	u8 ht_oper_len;
>   	u8 *ds_param;
> -	u8 ds_param_len;
>   
>   	if (mac->opmode != NL80211_IFTYPE_STATION)
>   		return false;
> @@ -2502,18 +2497,15 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
>   	/***** Parsing DS Param IE ******/
>   	ds_param = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_DS_PARAMS);
>   
> -	if (ds_param && !(ds_param[1] < sizeof(*ds_param))) {
> -		ds_param_len = ds_param[1];
> +	if (ds_param && !(ds_param[1] < sizeof(*ds_param)))
>   		bcn_key.bcn_channel = ds_param[2];
> -	} else {
> +	else
>   		ds_param = NULL;
> -	}
>   
>   	/***** Parsing HT Cap. IE ******/
>   	ht_cap = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_HT_CAPABILITY);
>   
>   	if (ht_cap && !(ht_cap[1] < sizeof(*ht_cap))) {
> -		ht_cap_len = ht_cap[1];
>   		ht_cap_ie = (struct ieee80211_ht_cap *)&ht_cap[2];
>   		bcn_key.ht_cap_info = ht_cap_ie->cap_info;
>   	} else  {
> @@ -2523,12 +2515,10 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void *data, unsigned int len)
>   	/***** Parsing HT Info. IE ******/
>   	ht_oper = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_HT_OPERATION);
>   
> -	if (ht_oper && !(ht_oper[1] < sizeof(*ht_oper))) {
> -		ht_oper_len = ht_oper[1];
> +	if (ht_oper && !(ht_oper[1] < sizeof(*ht_oper)))
>   		ht_oper_ie = (struct ieee80211_ht_operation *)&ht_oper[2];
> -	} else {
> +	else
>   		ht_oper = NULL;
> -	}
>   
>   	/* update bcn_key */
>   
>
>
>
>
>

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

end of thread, other threads:[~2019-04-06  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-06  3:12 [PATCH -next] staging: rtlwifi: base: Remove set but not used variables YueHaibing
2019-04-06  8:27 ` Mukesh Ojha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®