]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
dma: xilinx: zynqmp_dma: Fix race condition in the driver
authorKedareswara rao Appana <appana.durga.rao@xilinx.com>
Wed, 6 Jul 2016 13:04:24 +0000 (18:34 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 11 Jul 2016 13:02:46 +0000 (15:02 +0200)
In the driver software descriptor pools are allocated only when
SG is enabled in the driver. but we are freeing the desc polls in
Simple dma mode case also which is causing kernel crash when running
The dmatest client multiple times this patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Reviewed-by: Punnaiah Choudary Kalluri<punnaia@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/dma/xilinx/zynqmp_dma.c

index 09a7d207e725c4734e8fc22a30ebc44348d2cc9e..328b1d851c332607c23f1bd8d35b416dcd73d93a 100644 (file)
@@ -734,6 +734,10 @@ static void zynqmp_dma_free_chan_resources(struct dma_chan *dchan)
        zynqmp_dma_free_desc_list(chan, &chan->done_list);
 
        spin_unlock_bh(&chan->lock);
+
+       if (!chan->has_sg)
+               return;
+
        dma_free_coherent(chan->dev,
                (2 * ZYNQMP_DMA_DESC_SIZE(chan) * ZYNQMP_DMA_NUM_DESCS),
                chan->desc_pool_v, chan->desc_pool_p);