From: lintao Date: Tue, 9 Sep 2014 06:44:19 +0000 (+0800) Subject: mmc: fix resume kpanic if no dms been allocated when init X-Git-Tag: firefly_0821_release~4736 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8ae438b68066137d44bf35cf3784d2fe9c419cff;p=firefly-linux-kernel-4.4.55.git mmc: fix resume kpanic if no dms been allocated when init --- diff --git a/drivers/mmc/host/rk_sdmmc.c b/drivers/mmc/host/rk_sdmmc.c index 8daacd47a318..4db50856b0da 100755 --- a/drivers/mmc/host/rk_sdmmc.c +++ b/drivers/mmc/host/rk_sdmmc.c @@ -691,6 +691,10 @@ static int dw_mci_edmac_init(struct dw_mci *host) return 0; err_exit: + if (NULL != host->dms) { + kfree(host->dms); + host->dms = NULL; + } return -ENXIO; } @@ -699,8 +703,11 @@ static void dw_mci_edmac_exit(struct dw_mci *host) { dma_release_channel(host->dms->ch); host->dms->ch = NULL; - kfree(host->dms); - host->dms = NULL; + + if (NULL != host->dms) { + kfree(host->dms); + host->dms = NULL; + } } static const struct dw_mci_dma_ops dw_mci_edmac_ops = {