Skip to content

Commit fae88e0

Browse files
David LaightAndi Shyti
authored andcommitted
drivers/i2c/busses: use min() instead of min_t()
min_t(u8, a, b) casts both its arguments to u8 potentially discarding signifinact bits. Use min(a, b) instead as it cannot discard significant bits. Detected by an extra check added to min_t(). Signed-off-by: David Laight <david.laight.linux@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20251119224140.8616-21-david.laight.linux@gmail.com
1 parent 949f647 commit fae88e0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/i2c/busses/i2c-designware-master.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ i2c_dw_recv_len(struct dw_i2c_dev *dev, u8 len)
575575
* after receiving the first byte.
576576
*/
577577
len += (flags & I2C_CLIENT_PEC) ? 2 : 1;
578-
dev->tx_buf_len = len - min_t(u8, len, dev->rx_outstanding);
578+
dev->tx_buf_len = len - min(len, dev->rx_outstanding);
579579
msgs[dev->msg_read_idx].len = len;
580580
msgs[dev->msg_read_idx].flags &= ~I2C_M_RECV_LEN;
581581

0 commit comments

Comments
 (0)