提交 d50f4238 编写于 作者: A Arnd Bergmann 提交者: Ulf Hansson

mmc: tmio_mmc_dma: don't print invalid DMA cookie

The tmio_mmc_start_dma_{rx,tx} function functions contain debug
code that prints the dma cookie among other things. However,
in case we fall back to PIO mode for some reason, the cookie
variable is never initialized, and gcc warns about this:

In file included from ../include/linux/printk.h:277:0,
                 from ../include/linux/kernel.h:13,
                 from ../include/linux/list.h:8,
                 from ../include/linux/kobject.h:20,
                 from ../include/linux/device.h:17,
                 from ../drivers/mmc/host/tmio_mmc_dma.c:13:
../drivers/mmc/host/tmio_mmc_dma.c: In function 'tmio_mmc_start_dma':
../include/linux/dynamic_debug.h:86:3: warning: 'cookie' may be used uninitialized in this function [-Wmaybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^
../drivers/mmc/host/tmio_mmc_dma.c:128:15: note: 'cookie' was declared here
  dma_cookie_t cookie;

This modifies the dev_dbg() statements so we only print the cookie
when we are already in the DMA path.
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 e10c3219
...@@ -94,9 +94,9 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host) ...@@ -94,9 +94,9 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
desc = NULL; desc = NULL;
ret = cookie; ret = cookie;
} }
}
dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n", dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",
__func__, host->sg_len, ret, cookie, host->mrq); __func__, host->sg_len, ret, cookie, host->mrq);
}
pio: pio:
if (!desc) { if (!desc) {
...@@ -116,8 +116,8 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host) ...@@ -116,8 +116,8 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
"DMA failed: %d, falling back to PIO\n", ret); "DMA failed: %d, falling back to PIO\n", ret);
} }
dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__, dev_dbg(&host->pdev->dev, "%s(): desc %p, sg[%d]\n", __func__,
desc, cookie, host->sg_len); desc, host->sg_len);
} }
static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host) static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
...@@ -174,9 +174,9 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host) ...@@ -174,9 +174,9 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
desc = NULL; desc = NULL;
ret = cookie; ret = cookie;
} }
}
dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n", dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",
__func__, host->sg_len, ret, cookie, host->mrq); __func__, host->sg_len, ret, cookie, host->mrq);
}
pio: pio:
if (!desc) { if (!desc) {
...@@ -196,8 +196,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host) ...@@ -196,8 +196,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
"DMA failed: %d, falling back to PIO\n", ret); "DMA failed: %d, falling back to PIO\n", ret);
} }
dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__, dev_dbg(&host->pdev->dev, "%s(): desc %p\n", __func__, desc);
desc, cookie);
} }
void tmio_mmc_start_dma(struct tmio_mmc_host *host, void tmio_mmc_start_dma(struct tmio_mmc_host *host,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册