Skip to content

Commit

Permalink
i2c: imx-lpi2c: clean rx/tx buffers upon new message
Browse files Browse the repository at this point in the history
[ Upstream commit 987dd36 ]

When start sending a new message clear the Rx & Tx buffer pointers in
order to avoid using stale pointers.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tq-steina authored and gregkh committed Apr 20, 2023
1 parent 6e80b54 commit b2fcd69
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/i2c/busses/i2c-imx-lpi2c.c
Expand Up @@ -463,6 +463,8 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter,
if (num == 1 && msgs[0].len == 0)
goto stop;

lpi2c_imx->rx_buf = NULL;
lpi2c_imx->tx_buf = NULL;
lpi2c_imx->delivered = 0;
lpi2c_imx->msglen = msgs[i].len;
init_completion(&lpi2c_imx->complete);
Expand Down

0 comments on commit b2fcd69

Please sign in to comment.