[PATCH] wifi: mac80211: Fix -Wc23-extensions in hwmp_route_info_get()

Nathan Chancellor posted 1 patch 3 days, 7 hours ago
net/mac80211/mesh_hwmp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH] wifi: mac80211: Fix -Wc23-extensions in hwmp_route_info_get()
Posted by Nathan Chancellor 3 days, 7 hours ago
When building with a version of clang that supports
'-fms-anonymous-structs' (which will be used by the kernel instead of
the wider '-fms-extensions'), there are a couple warnings after some
recent mesg_hwmp.c changes:

  net/mac80211/mesh_hwmp.c:373:3: error: label followed by a declaration is a C23 extension [-Werror,-Wc23-extensions]
    373 |                 struct ieee80211_mesh_hwmp_preq_top *preq_elem_top =
        |                 ^
  net/mac80211/mesh_hwmp.c:390:3: error: label followed by a declaration is a C23 extension [-Werror,-Wc23-extensions]
    390 |                 struct ieee80211_mesh_hwmp_prep_top *prep_elem_top =
        |                 ^
  2 errors generated.

Enclose the switch case blocks in braces to clear up the warning.

Fixes: a91c65cb99d1 ("wifi: mac80211: Use struct instead of macro for PREP frame")
Fixes: 4ac20bd40b7d ("wifi: mac80211: Use struct instead of macro for PREQ frame")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 net/mac80211/mesh_hwmp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 84903737271d..7f962b003579 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -369,7 +369,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
 	fresh_info = true;
 
 	switch (action) {
-	case MPATH_PREQ:
+	case MPATH_PREQ: {
 		struct ieee80211_mesh_hwmp_preq_top *preq_elem_top =
 			(void *)hwmp_ie;
 		struct ieee80211_mesh_hwmp_preq_bottom *preq_elem_bottom =
@@ -381,7 +381,8 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
 		orig_metric = le32_to_cpu(preq_elem_bottom->metric);
 		hopcount = preq_elem_top->hopcount + 1;
 		break;
-	case MPATH_PREP:
+	}
+	case MPATH_PREP: {
 		/* Originator here refers to the MP that was the target in the
 		 * Path Request. We divert from the nomenclature in the draft
 		 * so that we can easily use a single function to gather path
@@ -398,6 +399,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
 		orig_metric = le32_to_cpu(prep_elem_bottom->metric);
 		hopcount = prep_elem_top->hopcount + 1;
 		break;
+	}
 	default:
 		rcu_read_unlock();
 		return 0;

---
base-commit: a26c2a22e7e88b2b5afb1349f3994fc564c988b1
change-id: 20260604-mac80211-mesh_hwmp-fix-c23-extensions-59bdcf6d8f94

Best regards,
--  
Cheers,
Nathan