Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: renesas_sdhi_internal_dmac: Fix missing unmap in error patch

This patch fixes an issue that lacks the dma_unmap_sg() calling in
the error patch of renesas_sdhi_internal_dmac_start_dma().

Fixes: 0cbc94daa554 ("mmc: renesas_sdhi_internal_dmac: limit DMA RX for old SoCs")
Cc: <stable@vger.kernel.org> # v4.17+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Yoshihiro Shimoda and committed by
Ulf Hansson
fe6e0494 021c9179

+6 -6
+6 -6
drivers/mmc/host/renesas_sdhi_internal_dmac.c
··· 164 164 goto force_pio; 165 165 166 166 /* This DMAC cannot handle if buffer is not 8-bytes alignment */ 167 - if (!IS_ALIGNED(sg_dma_address(sg), 8)) { 168 - dma_unmap_sg(&host->pdev->dev, sg, host->sg_len, 169 - mmc_get_dma_dir(data)); 170 - goto force_pio; 171 - } 167 + if (!IS_ALIGNED(sg_dma_address(sg), 8)) 168 + goto force_pio_with_unmap; 172 169 173 170 if (data->flags & MMC_DATA_READ) { 174 171 dtran_mode |= DTRAN_MODE_CH_NUM_CH1; 175 172 if (test_bit(SDHI_INTERNAL_DMAC_ONE_RX_ONLY, &global_flags) && 176 173 test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags)) 177 - goto force_pio; 174 + goto force_pio_with_unmap; 178 175 } else { 179 176 dtran_mode |= DTRAN_MODE_CH_NUM_CH0; 180 177 } ··· 185 188 sg_dma_address(sg)); 186 189 187 190 return; 191 + 192 + force_pio_with_unmap: 193 + dma_unmap_sg(&host->pdev->dev, sg, host->sg_len, mmc_get_dma_dir(data)); 188 194 189 195 force_pio: 190 196 host->force_pio = true;