Skip to content

Commit f1b59c2

Browse files
eason-huang-trondkalowsk
authored andcommitted
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 <[email protected]>
1 parent dd90248 commit f1b59c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/i2c/i2c_dw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct i2c_dw_dev_config {
137137
uint16_t lcnt;
138138

139139
volatile uint8_t state; /* last direction of transfer */
140-
uint8_t request_bytes;
140+
uint32_t request_bytes;
141141
uint8_t xfr_flags;
142142
bool support_hs_mode;
143143
#ifdef CONFIG_I2C_DW_LPSS_DMA

0 commit comments

Comments
 (0)