Browse Source

drivers: i2c_dw: fix request_bytes overflow when receiving > 256 bytes

The original definition of request_bytes as uint8_t caused incorrect
behavior when attempting to receive more than 256 bytes, as the variable
would overflow. This patch changes its type to uint32_t to allow
correct tracking of large I2C transfers.

Signed-off-by: Eason Huang <eason.huang@tronfuture.com>
pull/89290/head
Eason Huang 1 month ago committed by Dan Kalowsky
parent
commit
f1b59c2cd2
  1. 2
      drivers/i2c/i2c_dw.h

2
drivers/i2c/i2c_dw.h

@ -137,7 +137,7 @@ struct i2c_dw_dev_config { @@ -137,7 +137,7 @@ struct i2c_dw_dev_config {
uint16_t lcnt;
volatile uint8_t state; /* last direction of transfer */
uint8_t request_bytes;
uint32_t request_bytes;
uint8_t xfr_flags;
bool support_hs_mode;
#ifdef CONFIG_I2C_DW_LPSS_DMA

Loading…
Cancel
Save