Skip to content

Commit c35d3cf

Browse files
Marek VasutWolfram Sang
authored andcommitted
i2c: mxs: Handle i2c DMA failure properly
Properly terminate the DMA transfer in case the DMA PIO transfer or setup fails for any reason. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
1 parent 31f313d commit c35d3cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/i2c/busses/i2c-mxs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,14 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap,
287287
select_init_dma_fail:
288288
dma_unmap_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE);
289289
select_init_pio_fail:
290+
dmaengine_terminate_all(i2c->dmach);
290291
return -EINVAL;
291292

292293
/* Write failpath. */
293294
write_init_dma_fail:
294295
dma_unmap_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE);
295296
write_init_pio_fail:
297+
dmaengine_terminate_all(i2c->dmach);
296298
return -EINVAL;
297299
}
298300

0 commit comments

Comments
 (0)