Skip to content

Commit 11a427b

Browse files
Dan Carpentervinodkoul
authored andcommitted
dmaengine: sh: fix some NULL dereferences
The dma_free_coherent() function needs a valid device pointer or it will crash. Fixes: 550c591 ("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>
1 parent 1e00833 commit 11a427b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/dma/sh/rz-dmac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ static int rz_dmac_probe(struct platform_device *pdev)
919919
for (i = 0; i < channel_num; i++) {
920920
struct rz_dmac_chan *channel = &dmac->channels[i];
921921

922-
dma_free_coherent(NULL,
922+
dma_free_coherent(&pdev->dev,
923923
sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
924924
channel->lmdesc.base,
925925
channel->lmdesc.base_dma);
@@ -936,7 +936,7 @@ static int rz_dmac_remove(struct platform_device *pdev)
936936
for (i = 0; i < dmac->n_channels; i++) {
937937
struct rz_dmac_chan *channel = &dmac->channels[i];
938938

939-
dma_free_coherent(NULL,
939+
dma_free_coherent(&pdev->dev,
940940
sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
941941
channel->lmdesc.base,
942942
channel->lmdesc.base_dma);

0 commit comments

Comments
 (0)