Skip to contentSkip to conversation

ethtool: Fix declaration after label compilation error

PATCH Applied Gal Pressman 2 participants 2 messages Dec 31, 2025 – Jan 5

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

PATCH 1/1 ethtool: Fix declaration after label compilation error

Wrap case blocks in braces to allow variable declarations after case labels, fixing C89 compilation errors:

am65-cpsw-nuss.c: In function 'cpsw_dump_ale':
am65-cpsw-nuss.c:423:4: error: a label can only be part of a statement and a declaration is not a statement

      u32 oui_entry = cpsw_ale_get_oui_addr(ale_pos);
      ^~~
  am65-cpsw-nuss.c:432:4: error: a label can only be part of a statement and a declaration is not a statement
      u32 vlan_entry_type = cpsw_ale_get_vlan_entry_type(ale_pos);
      ^~~
Fixes eb91e05c98d4 ("pretty: Add support for TI K3 CPSW registers and ALE table dump")
---
 am65-cpsw-nuss.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
am65-cpsw-nuss.c +4 -2
index de8e3e9d4cc1..fbb20bf271e7 100644
@@ -419,7 +419,7 @@ void cpsw_dump_ale(struct k3_cpsw_regdump_hdr *ale_hdr, u32 *ale_pos)
 		case ALE_ENTRY_FREE:
 			break;
 
-		case ALE_ENTRY_ADDR:
+		case ALE_ENTRY_ADDR: {
 			u32 oui_entry = cpsw_ale_get_oui_addr(ale_pos);
 
 			if (oui_entry == 0x2)
@@ -427,8 +427,9 @@ void cpsw_dump_ale(struct k3_cpsw_regdump_hdr *ale_hdr, u32 *ale_pos)
 			else
 				cpsw_ale_dump_addr(i, ale_pos);
 			break;
+		}
 
-		case ALE_ENTRY_VLAN:
+		case ALE_ENTRY_VLAN: {
 			u32 vlan_entry_type = cpsw_ale_get_vlan_entry_type(ale_pos);
 
 			if (vlan_entry_type == VLAN_INNER_ENTRY)
@@ -442,6 +443,7 @@ void cpsw_dump_ale(struct k3_cpsw_regdump_hdr *ale_hdr, u32 *ale_pos)
 			else if (vlan_entry_type & VLAN_IPV6_ENTRY_MASK)
 				cpsw_ale_dump_ipv6_entry(i, ale_pos);
 			break;
+		}
 
 		case ALE_ENTRY_VLAN_ADDR:
 			cpsw_ale_dump_vlan_addr(i, ale_pos);
Signature · 1 line
2.40.1
#1 lore raw
This patch was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:

Hello:

This patch was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:

Quoted 5 lines · On Wed, 31 Dec 2025 13:25:33 +0200 you wrote:

Wrap case blocks in braces to allow variable declarations after case labels, fixing C89 compilation errors:

am65-cpsw-nuss.c: In function 'cpsw_dump_ale':
am65-cpsw-nuss.c:423:4: error: a label can only be part of a statement and a declaration is not a statement

Quoted 7 lines
      u32 oui_entry = cpsw_ale_get_oui_addr(ale_pos);
      ^~~
  am65-cpsw-nuss.c:432:4: error: a label can only be part of a statement and a declaration is not a statement
      u32 vlan_entry_type = cpsw_ale_get_vlan_entry_type(ale_pos);
      ^~~

[...]

Here is the summary with links:
- [ethtool] ethtool: Fix declaration after label compilation error

    https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=8e5c615a319f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html