Skip to content

Commit d70eaa3

Browse files
mellanoxbmcdavem330
authored andcommitted
mlxsw: i2c: Fix buffer increment counter for write transaction
It fixes a problem for the last chunk where 'chunk_size' is smaller than MLXSW_I2C_BLK_MAX and data is copied to the wrong offset, overriding previous data. Fixes: 6882b0a ("mlxsw: Introduce support for I2C bus") Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 122f00c commit d70eaa3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/ethernet/mellanox/mlxsw

drivers/net/ethernet/mellanox/mlxsw/i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ mlxsw_i2c_write(struct device *dev, size_t in_mbox_size, u8 *in_mbox, int num,
294294
write_tran.len = MLXSW_I2C_ADDR_WIDTH + chunk_size;
295295
mlxsw_i2c_set_slave_addr(tran_buf, off);
296296
memcpy(&tran_buf[MLXSW_I2C_ADDR_BUF_SIZE], in_mbox +
297-
chunk_size * i, chunk_size);
297+
MLXSW_I2C_BLK_MAX * i, chunk_size);
298298

299299
j = 0;
300300
end = jiffies + timeout;

0 commit comments

Comments
 (0)