Skip to content

Commit 267469b

Browse files
carlescufikartben
authored andcommitted
flash: spi_nor: Fix VLA error when building with clang
The following error is issued by clang when building with SPI_NOR_SFDP_RUNTIME enabled: error: fields must have a constant size: 'variable length array in structure' extension will never be supported 1379 | uint32_t dw[MIN(php->len_dw, 20)]; Instead, hardcode the array length to 20 32-bit words (it's instantiated in the stack anyway). Signed-off-by: Carles Cufi <[email protected]>
1 parent 5f5e311 commit 267469b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/flash/spi_nor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ static int spi_nor_process_sfdp(const struct device *dev)
13761376

13771377
if (id == JESD216_SFDP_PARAM_ID_BFP) {
13781378
union {
1379-
uint32_t dw[MIN(php->len_dw, 20)];
1379+
uint32_t dw[20];
13801380
struct jesd216_bfp bfp;
13811381
} u_param;
13821382
const struct jesd216_bfp *bfp = &u_param.bfp;

0 commit comments

Comments
 (0)