[v5,3/8] xilinx: v4l: dma: Terminate DMA when media pipeline fail to start

Message ID 8d18eea81b7d477d3802ebf185f995082f948ac5.1525312401.git.satish.nagireddy.nagireddy@xilinx.com (mailing list archive)
State New
Delegated to: Laurent Pinchart

Commit Message

Satish Kumar Nagireddy May 3, 2018, 2:42 a.m. UTC
  From: Vishal Sagar <vishal.sagar@xilinx.com>

If an incorrectly configured media pipeline is started, the allocated
dma descriptors aren't freed. This leads to kernel oops when pipeline
is configured correctly and run subsequently.

This patch also replaces dmaengine_terminate_all() with
dmaengine_terminate_sync() as the former one is deprecated.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
 drivers/media/platform/xilinx/xilinx-dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index 5426efe..727dc6e 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -437,6 +437,7 @@  static int xvip_dma_start_streaming(struct vb2_queue *vq, unsigned int count)
+	dmaengine_terminate_sync(dma->dma);
 	/* Give back all queued buffers to videobuf2. */
 	list_for_each_entry_safe(buf, nbuf, &dma->queued_bufs, queue) {
@@ -458,7 +459,7 @@  static void xvip_dma_stop_streaming(struct vb2_queue *vq)
 	xvip_pipeline_set_stream(pipe, false);
 	/* Stop and reset the DMA engine. */
-	dmaengine_terminate_all(dma->dma);
+	dmaengine_terminate_sync(dma->dma);
 	/* Cleanup the pipeline and mark it as being stopped. */