spi: spi-fsl-dspi: Fix incorrect freeing of DMA allocated buffers
authorSanchayan Maity <maitysanchayan@gmail.com>
Tue, 22 Nov 2016 07:01:32 +0000 (12:31 +0530)
committerMark Brown <broonie@kernel.org>
Tue, 22 Nov 2016 16:47:09 +0000 (16:47 +0000)
Buffers allocated with a call to dma_alloc_coherent should be
freed with dma_free_coherent instead of the currently used
devm_kfree.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c

index b1ee1f521ba04e2b00299fb3a09240ace27c9abf..22f7ce1279bd51d35bea6c388460325fcf6d1d22 100644 (file)
@@ -427,9 +427,11 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
        return 0;
 
 err_slave_config:
-       devm_kfree(dev, dma->rx_dma_buf);
+       dma_free_coherent(dev, DSPI_DMA_BUFSIZE,
+                       dma->rx_dma_buf, dma->rx_dma_phys);
 err_rx_dma_buf:
-       devm_kfree(dev, dma->tx_dma_buf);
+       dma_free_coherent(dev, DSPI_DMA_BUFSIZE,
+                       dma->tx_dma_buf, dma->tx_dma_phys);
 err_tx_dma_buf:
        dma_release_channel(dma->chan_tx);
 err_tx_channel: