From: Xiang W Date: Thu, 16 Sep 2021 04:32:50 +0000 (+0800) Subject: lib: sbi: Add BUG() macro for csr_read/write_num() and misa_string() X-Git-Tag: v1.3~442 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51113fe2a5ac6b5a712f2e5393347bf24194c09b;p=platform%2Fkernel%2Fopensbi-spacemit.git lib: sbi: Add BUG() macro for csr_read/write_num() and misa_string() We use BUG() macro in csr_read_num(), csr_write_num(), and misa_string() functions for unhandled cases. Signed-off-by: Xiang W Reviewed-by: Anup Patel --- diff --git a/lib/sbi/riscv_asm.c b/lib/sbi/riscv_asm.c index d7b9b2b..f6b8c8e 100644 --- a/lib/sbi/riscv_asm.c +++ b/lib/sbi/riscv_asm.c @@ -11,6 +11,7 @@ #include #include #include +#include /* determine CPU extension, return non-zero support */ int misa_extension_imp(char ext) @@ -75,6 +76,7 @@ void misa_string(int xlen, char *out, unsigned int out_sz) out[pos++] = '8'; break; default: + BUG(); return; } } @@ -134,6 +136,7 @@ unsigned long csr_read_num(int csr_num) #endif default: + BUG(); break; }; @@ -197,6 +200,7 @@ void csr_write_num(int csr_num, unsigned long val) switchcase_csr_write_16(CSR_MHPMEVENT16, val) default: + BUG(); break; };