Commit 90f1cb43 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Chris Ball

mmc: sh_mmcif: reset DMA completion immediately before starting DMA

DMA completion can be signalled from the DMA callback and from the error
handler. If both are called, the completion struct can enter an
inconsistent state. To prevent this move completion initialisation
immediately before activating DMA.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent aba9d646
...@@ -419,8 +419,6 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host, ...@@ -419,8 +419,6 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
if (ret < 0) if (ret < 0)
goto ecfgrx; goto ecfgrx;
init_completion(&host->dma_complete);
return; return;
ecfgrx: ecfgrx:
...@@ -1061,6 +1059,12 @@ static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host) ...@@ -1061,6 +1059,12 @@ static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host)
if (!data) if (!data)
return false; return false;
/*
* Completion can be signalled from DMA callback and error, so, have to
* reset here, before setting .dma_active
*/
init_completion(&host->dma_complete);
if (data->flags & MMC_DATA_READ) { if (data->flags & MMC_DATA_READ) {
if (host->chan_rx) if (host->chan_rx)
sh_mmcif_start_dma_rx(host); sh_mmcif_start_dma_rx(host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment