summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@ew.tq-group.com>2023-01-30 16:32:46 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 12:10:27 +0200
commite1f80b4dfad966638f5c65ae9f98d599c4be8cf2 (patch)
tree5f629185a082f13321f1e62317c376967d81bec9
parent81c30f89b9c3293b5b53e96b97fd71bc2d052c57 (diff)
downloadlinux-stable-e1f80b4dfad966638f5c65ae9f98d599c4be8cf2.tar.gz
linux-stable-e1f80b4dfad966638f5c65ae9f98d599c4be8cf2.tar.bz2
linux-stable-e1f80b4dfad966638f5c65ae9f98d599c4be8cf2.zip
i2c: imx-lpi2c: clean rx/tx buffers upon new message
[ Upstream commit 987dd36c0141f6ab9f0fbf14d6b2ec3342dedb2f ] 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>
-rw-r--r--drivers/i2c/busses/i2c-imx-lpi2c.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index 2018dbcf241e..d45ec26d51cb 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -462,6 +462,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);