]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
i2c: imx-lpi2c: clean rx/tx buffers upon new message
authorAlexander Stein <alexander.stein@ew.tq-group.com>
Mon, 30 Jan 2023 15:32:46 +0000 (16:32 +0100)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Wed, 17 May 2023 11:34:12 +0000 (13:34 +0200)
BugLink: https://bugs.launchpad.net/bugs/2017219
[ 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>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/i2c/busses/i2c-imx-lpi2c.c

index 9b2f9544c5681a799dc2b97dfefee75eca8df494..a49b14d52a98614bd5745baba5048ec24c43438a 100644 (file)
@@ -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);