From 925a7d045e6f0129bc58ccd4c3a8dcef62486345 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 18 Mar 2016 16:24:54 +0200 Subject: [PATCH] dmaengine: dw: set cdesc to NULL when free cyclic transfers To be sure we have the cyclic transfers already gone we set cdesc to NULL. It will prevent the double free. Signed-off-by: Andy Shevchenko Signed-off-by: Vinod Koul --- drivers/dma/dw/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index a6d96f32f4f9..dd47d4b8aad6 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c @@ -1522,6 +1522,8 @@ void dw_dma_cyclic_free(struct dma_chan *chan) kfree(cdesc->desc); kfree(cdesc); + dwc->cdesc = NULL; + clear_bit(DW_DMA_IS_CYCLIC, &dwc->flags); } EXPORT_SYMBOL(dw_dma_cyclic_free);