diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2015-05-26 06:11:28 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2015-06-02 09:03:08 -0400 |
commit | 429770823d961187c39df490d49683c467b10065 (patch) | |
tree | 1b64e2ad6ce073b73c31faed43653151cd0584cd | |
parent | 81cc6edc08705ac0146fe6ac14a0982a31ce6f3d (diff) |
dmaengine: hsu: Fix memory leak when stopping a running transfer
The vd->node is removed from the lists when the transfer started so the
vchan_get_all_descriptors() will not find it. This results memory leak.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
[andy: fix the typo to prevent a compilation error]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/hsu/hsu.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c index 9b84def7a353..f42f71e37e73 100644 --- a/drivers/dma/hsu/hsu.c +++ b/drivers/dma/hsu/hsu.c | |||
@@ -384,7 +384,10 @@ static int hsu_dma_terminate_all(struct dma_chan *chan) | |||
384 | spin_lock_irqsave(&hsuc->vchan.lock, flags); | 384 | spin_lock_irqsave(&hsuc->vchan.lock, flags); |
385 | 385 | ||
386 | hsu_dma_stop_channel(hsuc); | 386 | hsu_dma_stop_channel(hsuc); |
387 | hsuc->desc = NULL; | 387 | if (hsuc->desc) { |
388 | hsu_dma_desc_free(&hsuc->desc->vdesc); | ||
389 | hsuc->desc = NULL; | ||
390 | } | ||
388 | 391 | ||
389 | vchan_get_all_descriptors(&hsuc->vchan, &head); | 392 | vchan_get_all_descriptors(&hsuc->vchan, &head); |
390 | spin_unlock_irqrestore(&hsuc->vchan.lock, flags); | 393 | spin_unlock_irqrestore(&hsuc->vchan.lock, flags); |