summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/wbsd.c
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2017-01-14 01:52:51 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2017-02-13 15:20:26 +0300
commite81c022a00cd91b0d555d9d9194d421e3b8d642c (patch)
tree6864c26bc8142d3d297180ccaf266c97216db36c /drivers/mmc/host/wbsd.c
parente28d6f048799acb0014491e6b74e580d84bd7916 (diff)
downloadlinux-e81c022a00cd91b0d555d9d9194d421e3b8d642c.tar.xz
mmc: wbsd: safer check if dma_addr is valid DMA address
host->dma_addr can store a value that is not returned by the DMA API, so it is safer to check if is a valid DMA address indirectly. Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/wbsd.c')
-rw-r--r--drivers/mmc/host/wbsd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index 80a3b11f3217..bd04e8bae010 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1437,11 +1437,14 @@ err:
static void wbsd_release_dma(struct wbsd_host *host)
{
- if (!dma_mapping_error(mmc_dev(host->mmc), host->dma_addr)) {
+ /*
+ * host->dma_addr is valid here iff host->dma_buffer is not NULL.
+ */
+ if (host->dma_buffer) {
dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
+ kfree(host->dma_buffer);
}
- kfree(host->dma_buffer);
if (host->dma >= 0)
free_dma(host->dma);