dmaengine: at_xdmac: fix memory leak in interleaved mode
authorLudovic Desroches <ludovic.desroches@atmel.com>
Tue, 15 Sep 2015 13:38:24 +0000 (15:38 +0200)
committerVinod Koul <vinod.koul@intel.com>
Thu, 1 Oct 2015 02:00:56 +0000 (07:30 +0530)
In interleaved mode, when numf > 1, we have only one descriptor for the
transfer but this descriptor has to be added to the descs_list. If not,
when doing remove_xfer, the descriptor won't be put back in the
free_descs_list.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/at_xdmac.c

index 0190d1ca30044f1a6bcc7a55831596fb44122b4d..2ab6fe7339e605986a0e01876ee205e4f7138be0 100644 (file)
@@ -958,6 +958,10 @@ at_xdmac_prep_interleaved(struct dma_chan *chan,
                                                        xt, xt->sgl);
                for (i = 0; i < xt->numf; i++)
                        at_xdmac_increment_block_count(chan, first);
+
+               dev_dbg(chan2dev(chan), "%s: add desc 0x%p to descs_list 0x%p\n",
+                       __func__, first, first);
+               list_add_tail(&first->desc_node, &first->descs_list);
        } else {
                for (i = 0; i < xt->frame_size; i++) {
                        size_t src_icg = 0, dst_icg = 0;