Skip to contentSkip to conversation

Fix -Wunused-but-set-variable in net/mac80211/

PATCH In review Kirtika Ruchandani 3 participants 6 messages Nov 24, 2016 – Nov 28, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix -Wunused-but-set-variable in net/mac80211/

This patchset is part of the effort led by Arnd Bergmann to clean up warnings in the kernel. This and following patchsets will focus on "-Wunused-but-set-variable" as it among the noisier ones. These were found compiling with W=1.

Kirtika Ruchandani (4):
mac80211: Removed unused 'i' variable
mac80211: Remove unused 'len' variable
mac80211: Removed unused 'struct ieee80211_supported_band*' variable
mac80211: Remove unused 'beaconint_us' variable

 net/mac80211/chan.c | 4 +---
 net/mac80211/mlme.c | 4 ----
 net/mac80211/scan.c | 8 +++-----
 net/mac80211/vht.c  | 4 ----
 4 files changed, 4 insertions(+), 16 deletions(-)
Signature · 1 line
2.8.0.rc3.226.g39d4020
#1 lore raw

PATCH 1/4 mac80211: Removed unused 'i' variable

Commit 5bcae31d9 (mac80211: implement multi-vif in-place reservations) introduced ieee80211_vif_use_reserved_switch() with a counter variable
'i' that is set but not used. Compiling with W=1 gives the following
warning, fix it.
net/mac80211/chan.c: In function ‘ieee80211_vif_use_reserved_switch’:
net/mac80211/chan.c:1273:6: warning: variable ‘i’ set but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the noise obtained with W=1 in the kernel.

Fixes 5bcae31d9 ("mac80211: implement multi-vif in-place reservations")
Cc Michal Kazior <[email protected]>
Cc Johannes Berg <[email protected]>
---
 net/mac80211/chan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
net/mac80211/chan.c +1 -3
index e75cbf6..7550fd2 100644
@@ -1270,7 +1270,7 @@ static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local)
 	struct ieee80211_sub_if_data *sdata, *sdata_tmp;
 	struct ieee80211_chanctx *ctx, *ctx_tmp, *old_ctx;
 	struct ieee80211_chanctx *new_ctx = NULL;
-	int i, err, n_assigned, n_reserved, n_ready;
+	int err, n_assigned, n_reserved, n_ready;
 	int n_ctx = 0, n_vifs_switch = 0, n_vifs_assign = 0, n_vifs_ctxless = 0;
 
 	lockdep_assert_held(&local->mtx);
@@ -1391,8 +1391,6 @@ static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local)
 	 * Update all structures, values and pointers to point to new channel
 	 * context(s).
 	 */
-
-	i = 0;
 	list_for_each_entry(ctx, &local->chanctx_list, list) {
 		if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
 			continue;
Signature · 1 line
2.8.0.rc3.226.g39d4020
#2 lore raw

PATCH 2/4 mac80211: Remove unused 'len' variable

In reply to Kirtika Ruchandani

Commit 633e27132625 (mac80211: split sched scan IEs) introduced the len variable to keep track of the return value of ieee80211_build_preq_ies() but did not use it. Compiling with W=1 gives the following warning, fix it.

net/mac80211/scan.c: In function ‘__ieee80211_request_sched_scan_start’:
net/mac80211/scan.c:1123:9: warning: variable ‘len’ set but not used [-Wunused-but-set-variable]

This is a harmless warning and is only being fixed to reduce the noise with W=1 in the kernel.

Fixes 633e27132625 ("mac80211: split sched scan IEs")
Cc David Spinadel <[email protected]>
Cc Alexander Bondar <[email protected]>
Cc Johannes Berg <[email protected]>
---
 net/mac80211/scan.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
net/mac80211/scan.c +3 -5
index 23d8ac8..faab3c4 100644
@@ -1120,7 +1120,6 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
 	u32 rate_masks[NUM_NL80211_BANDS] = {};
 	u8 bands_used = 0;
 	u8 *ie;
-	size_t len;
 
 	iebufsz = local->scan_ies_len + req->ie_len;
 
@@ -1145,10 +1144,9 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
 
 	ieee80211_prepare_scan_chandef(&chandef, req->scan_width);
 
-	len = ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
-				       &sched_scan_ies, req->ie,
-				       req->ie_len, bands_used,
-				       rate_masks, &chandef);
+	ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
+				 &sched_scan_ies, req->ie,
+				 req->ie_len, bands_used, rate_masks, &chandef);
 
 	ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies);
 	if (ret == 0) {
Signature · 1 line
2.8.0.rc3.226.g39d4020

A message that is not in the archive (sent off-list or not yet received): cover.1479962513.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#4 lore raw

PATCH 3/4 mac80211: Removed unused 'struct ieee80211_supported_band*' variable

Commit b1bce14a7954 (mac80211: update opmode when adding new station) refactored ieee80211_vht_handle_opmode into __ieee80211_vht_handle_opmode and ieee80211_vht_handle_opmode leaving a set but unused variable (sband) in the former. Compiling with W=1 gives the following warning, fix it.

net/mac80211/vht.c: In function ‘__ieee80211_vht_handle_opmode’:
net/mac80211/vht.c:424:35: warning: variable ‘sband’ set but not used [-Wunused-but-set-variable]

Remove 'struct ieee80211_local* local' as well, it was only used to set sband.

This is a harmless warning, and is only being fixed to reduce the noise with W=1 in the kernel.

Fixes b1bce14a7954 ("mac80211: update opmode when adding new station")
Cc Marek Kwaczynski <[email protected]>
Cc Johannes Berg <[email protected]>
---
 net/mac80211/vht.c | 4 ----
 1 file changed, 4 deletions(-)
net/mac80211/vht.c +0 -3
index ee71576..14920e3 100644
@@ -420,14 +420,10 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
 				  struct sta_info *sta, u8 opmode,
 				  enum nl80211_band band)
 {
-	struct ieee80211_local *local = sdata->local;
-	struct ieee80211_supported_band *sband;
 	enum ieee80211_sta_rx_bandwidth new_bw;
 	u32 changed = 0;
 	u8 nss;
 
-	sband = local->hw.wiphy->bands[band];
#5 lore raw
In reply to a message not in the archive
Quoted 4 lines · Kirtika Ruchandani

This patchset is part of the effort led by Arnd Bergmann to clean up warnings in the kernel. This and following patchsets will focus on "-Wunused-but-set-variable" as it among the noisier ones. These were found compiling with W=1.

All four applied, thanks.

johannes

#6 lore raw

PATCH 4/4 mac80211: Remove unused 'beaconint_us' variable

In reply to Kirtika Ruchandani

Commit 4a733ef1bea7 (mac80211: remove PM-QoS listener) removed all use
of 'beaconint_us' from ieee80211_recalc_ps() but left the variable
intact. Compiling with W=1 gives the following warning, fix it.
net/mac80211/mlme.c: In function ‘ieee80211_recalc_ps’:
net/mac80211/mlme.c:1481:7: warning: variable ‘beaconint_us’ set but not used [-Wunused-but-set-variable]

iee80211_tu_to_usec has no side-effects and is safe to remove.

Fixes 4a733ef1bea7 ("mac80211: remove PM-QoS listener")
Cc Johannes Berg <[email protected]>
---
 net/mac80211/mlme.c | 4 ----
 1 file changed, 4 deletions(-)
net/mac80211/mlme.c +0 -4
index 7486f2d..e883345 100644
@@ -1478,10 +1478,6 @@ void ieee80211_recalc_ps(struct ieee80211_local *local)
 
 	if (count == 1 && ieee80211_powersave_allowed(found)) {
 		u8 dtimper = found->u.mgd.dtim_period;
-		s32 beaconint_us;
-
-		beaconint_us = ieee80211_tu_to_usec(
-					found->vif.bss_conf.beacon_int);
 
 		timeout = local->dynamic_ps_forced_timeout;
 		if (timeout < 0)
Signature · 1 line
2.8.0.rc3.226.g39d4020