summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-08-27 11:54:10 +0300
committerVinod Koul <vkoul@kernel.org>2021-08-31 21:50:23 +0530
commit11a427be2c4749954e8b868ef5301dc65ca5a14b (patch)
tree23b4fd99e535bd05dc6e74607aceea90b2dee089 /drivers/dma
parent1e008336b9f590eb749ac96ccef4ea0301f79619 (diff)
dmaengine: sh: fix some NULL dereferences
The dma_free_coherent() function needs a valid device pointer or it will crash. Fixes: 550c591a89a1 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20210827085410.GA9183@kili Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/sh/rz-dmac.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index 3d1c239de306..f9f30cbeccbe 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -919,7 +919,7 @@ err:
for (i = 0; i < channel_num; i++) {
struct rz_dmac_chan *channel = &dmac->channels[i];
- dma_free_coherent(NULL,
+ dma_free_coherent(&pdev->dev,
sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
channel->lmdesc.base,
channel->lmdesc.base_dma);
@@ -936,7 +936,7 @@ static int rz_dmac_remove(struct platform_device *pdev)
for (i = 0; i < dmac->n_channels; i++) {
struct rz_dmac_chan *channel = &dmac->channels[i];
- dma_free_coherent(NULL,
+ dma_free_coherent(&pdev->dev,
sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
channel->lmdesc.base,
channel->lmdesc.base_dma);