Skip to content

Commit 5f07ef8

Browse files
Wolfram Sangstorulf
authored andcommitted
mmc: tmio: always unmap DMA before waiting for interrupt
In the (maybe academical) case, we don't get a DATAEND interrupt after DMA completed, we will wait endlessly for the completion to complete. This is not bad per se, since we have a more generic completion tracking a timeout. In that rare case, however, the DMA buffer will not get unmapped and we have a leak. Reorder the code, so unmapping will always take place. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 48d685a commit 5f07ef8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/mmc/host/tmio_mmc_dma.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ static void tmio_mmc_dma_callback(void *arg)
4747
{
4848
struct tmio_mmc_host *host = arg;
4949

50-
wait_for_completion(&host->dma_dataend);
51-
5250
spin_lock_irq(&host->lock);
5351

5452
if (!host->data)
@@ -63,6 +61,11 @@ static void tmio_mmc_dma_callback(void *arg)
6361
host->sg_ptr, host->sg_len,
6462
DMA_TO_DEVICE);
6563

64+
spin_unlock_irq(&host->lock);
65+
66+
wait_for_completion(&host->dma_dataend);
67+
68+
spin_lock_irq(&host->lock);
6669
tmio_mmc_do_data_irq(host);
6770
out:
6871
spin_unlock_irq(&host->lock);

0 commit comments

Comments
 (0)