mirror of
https://github.com/apache/nuttx.git
synced 2026-06-09 02:44:53 +08:00
risc-v/mpfs: fix compile warning
After commit b7d2b38, the system suffers from -Warray-bounds warning with -Wall:
chip/mpfs_opensbi.c: In function 'mpfs_hart_to_scratch':
chip/mpfs_opensbi.c:251:26: warning: array subscript hartid is outside array bounds of 'sbi_scratch_holder_t[0]' {aka 'struct sbi_scratch_holder_s[]'} [-Warray-bounds]
251 | return (unsigned long)(&g_scratches[hartid].scratch);
Fix it by reverting back to what is was earlier. g_scratches shouldn't be in the bss
region that would be zeroed out.
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This commit is contained in:
committed by
Petro Karashchenko
parent
f420b4dce7
commit
6596f0e99a
@@ -225,7 +225,7 @@ static const struct sbi_platform platform =
|
||||
|
||||
/* This must go into l2_scratchpad region, starting at 0x0a000000. */
|
||||
|
||||
sbi_scratch_holder_t g_scratches[0] \
|
||||
sbi_scratch_holder_t g_scratches[MPFS_MAX_NUM_HARTS] \
|
||||
__attribute__((section(".l2_scratchpad")));
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user