mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
mmc: sdhci check parameters before call dma_free_coherent
We should not call dma_free_coherent if host->adma_table is NULL,
otherwise may trigger panic.
Fixes: d1e49f77d7 ("mmc: sdhci: convert ADMA descriptors to a...")
Signed-off-by: Peng Fan <[email protected]>
Acked-by: Adrian Hunter <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
This commit is contained in:
parent
5027cd1e32
commit
7ac020366b
1 changed files with 5 additions and 2 deletions
|
|
@ -2978,8 +2978,11 @@ int sdhci_add_host(struct sdhci_host *host)
|
|||
GFP_KERNEL);
|
||||
host->align_buffer = kmalloc(host->align_buffer_sz, GFP_KERNEL);
|
||||
if (!host->adma_table || !host->align_buffer) {
|
||||
dma_free_coherent(mmc_dev(mmc), host->adma_table_sz,
|
||||
host->adma_table, host->adma_addr);
|
||||
if (host->adma_table)
|
||||
dma_free_coherent(mmc_dev(mmc),
|
||||
host->adma_table_sz,
|
||||
host->adma_table,
|
||||
host->adma_addr);
|
||||
kfree(host->align_buffer);
|
||||
pr_warn("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n",
|
||||
mmc_hostname(mmc));
|
||||
|
|
|
|||
Loading…
Reference in a new issue