aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2024-01-06 17:54:24 +0100
committerEvgeniy Naydanov <109669442+en-sc@users.noreply.github.com>2024-01-29 13:36:27 +0300
commit8411330fcc860b0bd14cfd8ca7b2b87d34784cf9 (patch)
treec9bca90ef14de89acea223c46a33ffd68eabf85f
parent37d4eaf5b12a06a85fb88f58407c962419af0c41 (diff)
downloadriscv-openocd-8411330fcc860b0bd14cfd8ca7b2b87d34784cf9.zip
riscv-openocd-8411330fcc860b0bd14cfd8ca7b2b87d34784cf9.tar.gz
riscv-openocd-8411330fcc860b0bd14cfd8ca7b2b87d34784cf9.tar.bz2
target/mips32: fix false positive from clang
clang build triggers an error for an uninitialized value of the variable 'instr'. This is a false positive, as the macro #define MIPS32_CONFIG3_ISA_MASK (3 << MIPS32_CONFIG3_ISA_SHIFT) guarantees the switch/case already covers all the possible values with cases 0, 1, 2 and 3. Silent clang by adding a useless default case to the switch. While there, fix the indentation of the switch/case accordingly to OpenOCD coding style. Change-Id: I0ae316754ce7d091dd8366bf314b8e6ee780e313 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 7de4b1202d50 ("target/mips32: add cpu info detection") Reviewed-on: https://review.openocd.org/c/openocd/+/8065 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
-rw-r--r--src/target/mips32.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/target/mips32.c b/src/target/mips32.c
index 8a3ddbf..5b94e6c 100644
--- a/src/target/mips32.c
+++ b/src/target/mips32.c
@@ -1607,17 +1607,18 @@ COMMAND_HANDLER(mips32_handle_cpuinfo_command)
char *instr;
switch ((config3 & MIPS32_CONFIG3_ISA_MASK) >> MIPS32_CONFIG3_ISA_SHIFT) {
- case 0:
- instr = "MIPS32";
+ case 0:
+ instr = "MIPS32";
break;
- case 1:
- instr = "microMIPS";
+ case 1:
+ instr = "microMIPS";
break;
- case 2:
- instr = "MIPS32 (at reset) and microMIPS";
+ case 2:
+ instr = "MIPS32 (at reset) and microMIPS";
break;
- case 3:
- instr = "microMIPS (at reset) and MIPS32";
+ case 3:
+ default:
+ instr = "microMIPS (at reset) and MIPS32";
break;
}