Message ID | 20181019191526.3712-1-wsa+renesas@sang-engineering.com |
---|---|
State | Accepted |
Headers | show |
Series | i2c: rcar: cleanup DMA for all kinds of failure | expand |
On Fri, Oct 19, 2018 at 09:15:26PM +0200, Wolfram Sang wrote: > DMA needs to be cleaned up not only on timeout, but on all errors where > it has been setup before. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Added fixes-tag and applied to for-current, thanks!
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 52cf42b32f0a..4aa7dde876f3 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -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) {
DMA needs to be cleaned up not only on timeout, but on all errors where it has been setup before. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- Reported and tested by the BSP team. drivers/i2c/busses/i2c-rcar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)