From: Jaehoon Chung Date: Wed, 18 Apr 2012 06:42:31 +0000 (+0900) Subject: mmc: dw_mmc: prevent NULL dereference for dma_ops X-Git-Tag: v3.4-rc4~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1631f989e0c6c8d9b43a2dbdd1097f70da603a5;p=profile%2Fcommon%2Fkernel-common.git mmc: dw_mmc: prevent NULL dereference for dma_ops Now, dma_ops is assumed that use the IDMAC. But if dma_ops is assigned the pdata->dma_ops, we didn't ensure that callback function is defined. If the callback isn't defined, then we should run in PIO mode. Signed-off-by: Jaehoon Chung Signed-off-by: Kyungmin Park Acked-by: Will Newton Signed-off-by: Chris Ball --- diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index f3b0fcd..ab3fc46 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1881,7 +1881,8 @@ static void dw_mci_init_dma(struct dw_mci *host) if (!host->dma_ops) goto no_dma; - if (host->dma_ops->init) { + if (host->dma_ops->init && host->dma_ops->start && + host->dma_ops->stop && host->dma_ops->cleanup) { if (host->dma_ops->init(host)) { dev_err(&host->dev, "%s: Unable to initialize " "DMA Controller.\n", __func__);