aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/cpu/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/riscv/cpu/cpu.c')
-rw-r--r--arch/riscv/cpu/cpu.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
index 8445c58..ecfefa1 100644
--- a/arch/riscv/cpu/cpu.c
+++ b/arch/riscv/cpu/cpu.c
@@ -49,14 +49,24 @@ static inline bool supports_extension(char ext)
}
if (!cpu_get_desc(dev, desc, sizeof(desc))) {
/*
- * skip the first 4 characters (rv32|rv64) and
- * check until underscore
+ * skip the first 4 characters (rv32|rv64)
*/
for (i = 4; i < sizeof(desc); i++) {
- if (desc[i] == '_' || desc[i] == '\0')
- break;
- if (desc[i] == ext)
- return true;
+ switch (desc[i]) {
+ case 's':
+ case 'x':
+ case 'z':
+ case '_':
+ case '\0':
+ /*
+ * Any of these characters mean the single
+ * letter extensions have all been consumed.
+ */
+ return false;
+ default:
+ if (desc[i] == ext)
+ return true;
+ }
}
}