]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
dmaengine: xilinx: dpdma: Rechedule errored descriptor
authorHyun Kwon <hyun.kwon@xilinx.com>
Fri, 19 Jan 2018 02:00:24 +0000 (18:00 -0800)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 1 Mar 2018 08:20:03 +0000 (09:20 +0100)
If there's an error, reschedule the descriptor by adding it
back to submitted descriptor. If there's already pending or
submitted descriptor, drop and free the error descriptor properly.
Previously, the dropped descriptor wasn't freed properly.

Reported-by: Varunkumar Allagadapa <varunkum@xilinx.com>
Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Tested-by: Varunkumar Allagadapa <varunkum@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/dma/xilinx/xilinx_dpdma.c

index 9217f6b2538886c2d6d3fc7c9cbe8c69a1a783a3..bbc1d92108c2cf19207671d5459001a5c97b8df0 100644 (file)
@@ -1745,9 +1745,12 @@ static void xilinx_dpdma_chan_handle_err(struct xilinx_dpdma_chan *chan)
        case ACTIVE:
        case PREPARED:
                /* Reschedule if there's no new descriptor */
-               if (!chan->submitted_desc)
+               if (!chan->pending_desc && !chan->submitted_desc) {
+                       chan->active_desc->status = ERRORED;
                        chan->submitted_desc = chan->active_desc;
-               chan->active_desc->status = ERRORED;
+               } else {
+                       xilinx_dpdma_chan_free_tx_desc(chan, chan->active_desc);
+               }
                break;
        }
        chan->active_desc = NULL;