From: Vishal Sagar <vishal.sa...@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.sa...@xilinx.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagire...@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)
        media_pipeline_stop(&dma->video.entity);
 
 error:
+       dmaengine_terminate_sync(dma->dma);
        /* Give back all queued buffers to videobuf2. */
        spin_lock_irq(&dma->queued_lock);
        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. */
        xvip_pipeline_cleanup(pipe);
-- 
2.7.4

Reply via email to