diff options
| author | Xiang W <[email protected]> | 2023-02-21 13:07:07 +0800 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-02-27 10:49:09 +0530 |
| commit | 6861ee996ce5b1f2017ca7a9b0342f9cd9462917 (patch) | |
| tree | 15fb1658792c40646d3b579abd7e7b64629318cd | |
| parent | 99d09b601eb3809a4cc2aa409da34bc4fe32f67f (diff) | |
lib: utils: fdt_fixup: Fix compile error
When building with GCC-10 or older versions, it throws the following
error:
CC-DEP platform/generic/lib/utils/fdt/fdt_fixup.dep
CC platform/generic/lib/utils/fdt/fdt_fixup.o
lib/utils/fdt/fdt_fixup.c: In function 'fdt_reserved_memory_fixup':
lib/utils/fdt/fdt_fixup.c:376:2: error: label at end of compound statement
376 | next_entry:
| ^~~~~~~~~~
Remove the goto statement.
Resolves: https://github.com/riscv-software-src/opensbi/issues/288
Signed-off-by: Yu Chien Peter Lin <[email protected]>
Signed-off-by: Xiang W <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
| -rw-r--r-- | lib/utils/fdt/fdt_fixup.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c index 619e4f5c..c10179b9 100644 --- a/lib/utils/fdt/fdt_fixup.c +++ b/lib/utils/fdt/fdt_fixup.c @@ -361,19 +361,22 @@ int fdt_reserved_memory_fixup(void *fdt) return SBI_ENOSPC; } + bool overlap = false; addr = reg->base; for (j = 0; j < i; j++) { if (addr == filtered_base[j] && filtered_order[j] < reg->order) { + overlap = true; filtered_order[j] = reg->order; - goto next_entry; + break; } } - filtered_base[i] = reg->base; - filtered_order[i] = reg->order; - i++; - next_entry: + if (!overlap) { + filtered_base[i] = reg->base; + filtered_order[i] = reg->order; + i++; + } } for (j = 0; j < i; j++) { |
