diff options
| author | Heinrich Schuchardt <[email protected]> | 2023-09-28 14:17:20 +0200 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-10-06 17:28:52 +0530 |
| commit | 942aca232ec8e412160bdc9cd3331a63eaf1ff24 (patch) | |
| tree | 712e436c30bc598ad89f5f44a88f1b39c9ca7eb3 /lib | |
| parent | 9da30f6105565c920d1e27c08cb67284619d6984 (diff) | |
lib: utils: Simplify SET_ISA_EXT_MAP()
The define is hard to read. The continue statement does not do what was
intended.
* Remove do {} while (false);
* Change the name to set_multi_letter_ext
- Other local macros are lower case too.
- Refer to the fact that this is only used for multi-letter extensions.
Addresses-Coverity-ID: 1568359 Unexpected control flow
Fixes: d72f5f17478d ("lib: utils: Add detection of Smepmp from ISA string in FDT")
Signed-off-by: Heinrich Schuchardt <[email protected]>
Reviewed-by: Xiang W <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils/fdt/fdt_helper.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c index 13e79b96..9ae7f09f 100644 --- a/lib/utils/fdt/fdt_helper.c +++ b/lib/utils/fdt/fdt_helper.c @@ -369,16 +369,14 @@ static int fdt_parse_isa_one_hart(const char *isa, unsigned long *extensions) if (!j) continue; -#define SET_ISA_EXT_MAP(name, bit) \ - do { \ +#define set_multi_letter_ext(name, bit) \ if (!strcmp(mstr, name)) { \ __set_bit(bit, extensions); \ continue; \ - } \ - } while (false) \ + } - SET_ISA_EXT_MAP("smepmp", SBI_HART_EXT_SMEPMP); -#undef SET_ISA_EXT_MAP + set_multi_letter_ext("smepmp", SBI_HART_EXT_SMEPMP); +#undef set_multi_letter_ext } return 0; |
