lib: utils: fdt_fixup: Fix compile error
PATCH 1/1 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.olib/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:
| ^~~~~~~~~~Thus move the label "next_entry" to the beginning of the for loop. Fixed issue#288 [1]
[1]: https://github.com/riscv-software-src/opensbi/issues/288
--- lib/utils/fdt/fdt_fixup.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
lib/utils/fdt/fdt_fixup.c +8 -5
@@ -361,19 +361,22 @@ int fdt_reserved_memory_fixup(void *fdt)return SBI_ENOSPC ; } +int overlap =0 ; addr = reg->base;for (j =0 ; j < i; j++) {if (addr == filtered_base[j] && filtered_order[j] < reg->order) { + overlap =1 ; 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++) {
Signature · 1 line
2.39.1
PATCH 1/1 lib: utils: fdt_fixup: Fix compile error
Quoted 1 line · Xiang W
Thus move the label "
next_entry" to the beginning of the for loop.
This is not what the patch does.
Signature · 3 lines
Andreas Schwab, schwab at linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
PATCH 1/1 lib: utils: fdt_fixup: Fix compile error
? 2023-02-19???? 11:20 +0100?Andreas Schwab???
Quoted 5 lines · Xiang W
Quoted 2 lines
Thus move the label "
next_entry" to the beginning of the for loop.This is not what the patch does.
new patch at https://lists.infradead.org/pipermail/opensbi/2023-February/004494.html
Regards,
Xiang