[PATCH 1/1] lib: utils: mpxy: mm: move attr_rsp before the first case

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Fri Nov 20 05:23:35 PST 2026


The switch in mpxy_rpmi_mm_complete() declares attr_rsp right after
a case label. A declaration after a label is only valid in C23, and
the build uses -std=gnu11. GCC accepts it silently if not building with
-Wpedantic, but Clang stops with -Werror,-Wc23-extensions:

  fdt_mpxy_rpmi_bridge_mm.c:160:4: error: label followed by a
  declaration is a C23 extension

so "make LLVM=1" fails for the generic platform.

Declare the variable at the start of the switch body, before the
first case label. The scope is the same as before, the whole switch
block, and the code is valid in C11. While at it, remove the stray
tab after the assignment operator.

Fixes: 37bde95c8c38 ("sbi_utils: mpxy:: Add MPXY RPMI bridge MM driver")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 lib/utils/mpxy/fdt_mpxy_rpmi_bridge_mm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_bridge_mm.c b/lib/utils/mpxy/fdt_mpxy_rpmi_bridge_mm.c
index 55b31872..29e3fca0 100644
--- a/lib/utils/mpxy/fdt_mpxy_rpmi_bridge_mm.c
+++ b/lib/utils/mpxy/fdt_mpxy_rpmi_bridge_mm.c
@@ -156,9 +156,10 @@ static int mpxy_rpmi_mm_complete(struct mpxy_bridge_src_ctx *src,
 		return ret;
 
 	switch (src->header.service_id) {
+		struct rpmi_mm_get_attributes_rsp *attr_rsp;
+
 		case RPMI_MM_SRV_GET_ATTRIBUTES:
-			struct rpmi_mm_get_attributes_rsp *attr_rsp;
-			attr_rsp = 	(struct rpmi_mm_get_attributes_rsp *)payload;
+			attr_rsp = (struct rpmi_mm_get_attributes_rsp *)payload;
 
 			mm_shmem.addr = ((u64)le32_to_cpu(attr_rsp->mma.shmem_addr_hi) << 32) |
 				(u64)le32_to_cpu(attr_rsp->mma.shmem_addr_lo);
-- 
2.53.0




More information about the opensbi mailing list