Skip to content

Commit 31d8603

Browse files
Wolfram SangWolfram Sang
authored andcommitted
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: 73e8b05 ("i2c: rcar: add DMA support") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent 72a7a4a commit 31d8603

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/i2c/busses/i2c-rcar.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,12 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
806806

807807
time_left = wait_event_timeout(priv->wait, priv->flags & ID_DONE,
808808
num * adap->timeout);
809-
if (!time_left) {
809+
810+
/* cleanup DMA if it couldn't complete properly due to an error */
811+
if (priv->dma_direction != DMA_NONE)
810812
rcar_i2c_cleanup_dma(priv);
813+
814+
if (!time_left) {
811815
rcar_i2c_init(priv);
812816
ret = -ETIMEDOUT;
813817
} else if (priv->flags & ID_NACK) {

0 commit comments

Comments
 (0)