Skip to content

Commit 70fe961

Browse files
ananglcfriedt
authored andcommitted
drivers: mspi_dw: Use uint32_t for dummy_bytes field
Since the driver allows transfer lengths up to `UINT16_MAX + 1` bytes, and additionally the `dummy_bytes` field includes bytes sent to provide wait cycles on the bus, the type of this field must be `uint32_t`, otherwise it can be overflowed for RX transfers close to the maximum. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 8fb6cb7 commit 70fe961

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/mspi/mspi_dw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct mspi_dw_data {
5959
enum mspi_cpp_mode xip_cpp;
6060
#endif
6161

62-
uint16_t dummy_bytes;
62+
uint32_t dummy_bytes;
6363
uint8_t bytes_to_discard;
6464
uint8_t bytes_per_frame_exp;
6565
bool standard_spi;
@@ -317,7 +317,7 @@ static bool tx_dummy_bytes(const struct device *dev, bool *repeat)
317317
uint8_t fifo_room = dev_config->max_queued_dummy_bytes
318318
- FIELD_GET(TXFLR_TXTFL_MASK, read_txflr(dev));
319319
uint8_t rx_fifo_items = FIELD_GET(RXFLR_RXTFL_MASK, read_rxflr(dev));
320-
uint16_t dummy_bytes = dev_data->dummy_bytes;
320+
uint32_t dummy_bytes = dev_data->dummy_bytes;
321321
const uint8_t dummy_val = 0;
322322

323323
/* Subtract the number of items that are already stored in the RX

0 commit comments

Comments
 (0)