Skip to content

Commit 40c67c2

Browse files
JiangJiasstorulf
authored andcommitted
mmc: sdhci-of-esdhc: Check for error num after setting mask
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails. And since the sdhci_setup_host() has already checked the return value of the enable_dma, we need not check it in sdhci_resume_host() again. Fixes: 5552d7a ("mmc: sdhci-of-esdhc: set proper dma mask for ls104x chips") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220112083156.1124782-1-jiasheng@iscas.ac.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent e783362 commit 40c67c2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/mmc/host/sdhci-of-esdhc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,16 @@ static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
524524

525525
static int esdhc_of_enable_dma(struct sdhci_host *host)
526526
{
527+
int ret;
527528
u32 value;
528529
struct device *dev = mmc_dev(host->mmc);
529530

530531
if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") ||
531-
of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc"))
532-
dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
532+
of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) {
533+
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
534+
if (ret)
535+
return ret;
536+
}
533537

534538
value = sdhci_readl(host, ESDHC_DMA_SYSCTL);
535539

0 commit comments

Comments
 (0)