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>
This commit is contained in:
committed by
Ulf Hansson
parent
48d685a2ec
commit
5f07ef8f60
@@ -47,8 +47,6 @@ static void tmio_mmc_dma_callback(void *arg)
|
|||||||
{
|
{
|
||||||
struct tmio_mmc_host *host = arg;
|
struct tmio_mmc_host *host = arg;
|
||||||
|
|
||||||
wait_for_completion(&host->dma_dataend);
|
|
||||||
|
|
||||||
spin_lock_irq(&host->lock);
|
spin_lock_irq(&host->lock);
|
||||||
|
|
||||||
if (!host->data)
|
if (!host->data)
|
||||||
@@ -63,6 +61,11 @@ static void tmio_mmc_dma_callback(void *arg)
|
|||||||
host->sg_ptr, host->sg_len,
|
host->sg_ptr, host->sg_len,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
|
|
||||||
|
spin_unlock_irq(&host->lock);
|
||||||
|
|
||||||
|
wait_for_completion(&host->dma_dataend);
|
||||||
|
|
||||||
|
spin_lock_irq(&host->lock);
|
||||||
tmio_mmc_do_data_irq(host);
|
tmio_mmc_do_data_irq(host);
|
||||||
out:
|
out:
|
||||||
spin_unlock_irq(&host->lock);
|
spin_unlock_irq(&host->lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user