[PATCH 1/3] mesh: Fix some compiler warnings

Masashi Honma masashi.honma at gmail.com
Fri Apr 13 01:38:34 PDT 2018


mesh.c: In function ‘wpa_supplicant_mesh_init’:
mesh.c:203:9: warning: unused variable ‘len’ [-Wunused-variable]
  size_t len;
         ^
mesh.c:202:13: warning: unused variable ‘default_groups’ [-Wunused-variable]
  static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
             ^

ap.c: In function ‘wpas_ap_ch_switch’:
ap.c:1333:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
  if (!wpa_s->ap_iface)
     ^
ap.c: In function ‘wpas_event_dfs_radar_detected’:
ap.c:1541:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
  if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
     ^
ap.c: In function ‘wpas_event_dfs_cac_started’:
ap.c:1559:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
  if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
     ^
ap.c: In function ‘wpas_event_dfs_cac_finished’:
ap.c:1576:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
  if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
     ^
ap.c: In function ‘wpas_event_dfs_cac_aborted’:
ap.c:1594:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
  if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
     ^
ap.c: In function ‘wpas_event_dfs_cac_nop_finished’:
ap.c:1611:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
  if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
     ^

Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
 wpa_supplicant/ap.c   | 19 ++++++++++++-------
 wpa_supplicant/mesh.c |  2 --
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 17b32fb..114848a 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1330,11 +1330,12 @@ void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
 {
 	struct hostapd_iface *iface = wpa_s->ap_iface;
 
-	if (!wpa_s->ap_iface)
+	if (!wpa_s->ap_iface) {
 		if (!wpa_s->ifmsh)
 			return;
 		else
 			iface = wpa_s->ifmsh;
+	}
 
 	wpa_s->assoc_freq = freq;
 	if (wpa_s->current_ssid)
@@ -1538,11 +1539,12 @@ void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
 {
 	struct hostapd_iface *iface = wpa_s->ap_iface;
 
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
 		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
 			return;
 		else
 			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
 	hostapd_dfs_radar_detected(iface, radar->freq,
 				   radar->ht_enabled, radar->chan_offset,
@@ -1556,11 +1558,12 @@ void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
 {
 	struct hostapd_iface *iface = wpa_s->ap_iface;
 
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
 		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
 			return;
 		else
 			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
 	hostapd_dfs_start_cac(iface, radar->freq,
 			      radar->ht_enabled, radar->chan_offset,
@@ -1573,12 +1576,12 @@ void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
 {
 	struct hostapd_iface *iface = wpa_s->ap_iface;
 
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
 		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
 			return;
 		else
 			iface = wpa_s->ifmsh;
-
+	}
 	wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
 	hostapd_dfs_complete_cac(iface, 1, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
@@ -1591,11 +1594,12 @@ void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
 {
 	struct hostapd_iface *iface = wpa_s->ap_iface;
 
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
 		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
 			return;
 		else
 			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
 	hostapd_dfs_complete_cac(iface, 0, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
@@ -1608,11 +1612,12 @@ void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
 {
 	struct hostapd_iface *iface = wpa_s->ap_iface;
 
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
 		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
 			return;
 		else
 			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
 	hostapd_dfs_nop_finished(iface, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 22dec48..9450bc4 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -199,8 +199,6 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 	struct hostapd_config *conf;
 	struct mesh_conf *mconf;
 	int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 };
-	static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
-	size_t len;
 	int rate_len;
 	int frequency;
 
-- 
2.7.4




More information about the Hostap mailing list