Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31d86033 authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang
Browse files

i2c: rcar: cleanup DMA for all kinds of failure



DMA needs to be cleaned up not only on timeout, but on all errors where
it has been setup before.

Fixes: 73e8b052 ("i2c: rcar: add DMA support")
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 72a7a4aa
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -806,8 +806,12 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,

	time_left = wait_event_timeout(priv->wait, priv->flags & ID_DONE,
				     num * adap->timeout);
	if (!time_left) {

	/* cleanup DMA if it couldn't complete properly due to an error */
	if (priv->dma_direction != DMA_NONE)
		rcar_i2c_cleanup_dma(priv);

	if (!time_left) {
		rcar_i2c_init(priv);
		ret = -ETIMEDOUT;
	} else if (priv->flags & ID_NACK) {