mmc: fix resume kpanic if no dms been allocated when init
authorlintao <lintao@rock-chips.com>
Tue, 9 Sep 2014 06:44:19 +0000 (14:44 +0800)
committerlintao <lintao@rock-chips.com>
Tue, 9 Sep 2014 06:44:19 +0000 (14:44 +0800)
drivers/mmc/host/rk_sdmmc.c

index 8daacd47a31851fb771da419a4c550020c2c8e59..4db50856b0da574de99e0e50a6131bff0d935150 100755 (executable)
@@ -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 = {