Skip to content

Commit

Permalink
Revert "dma-trace: Fix memory leak with buffer allocation on dtrace r…
Browse files Browse the repository at this point in the history
…e-config"

This reverts commit d791e64.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
  • Loading branch information
ujfalusi committed Oct 28, 2021
1 parent d791e64 commit 84d8153
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/trace/dma-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,6 @@ static int dma_trace_buffer_alloc(struct dma_trace_data *d)
{
void *buf;

/*
* Keep the existing dtrace buffer to avoid memory leak, unlikely to
* happen if host correctly using the dma_trace_disable().
*
* The buffer can not be freed up here as it is likely in use.
* The (re-)initialization will happen in dma_trace_start() when it is
* safe to do (the DMA is stopped)
*/
if (dma_trace_initialized(d))
return 0;

/* allocate new buffer */
buf = rballoc(0, SOF_MEM_CAPS_RAM | SOF_MEM_CAPS_DMA,
DMA_TRACE_LOCAL_SIZE);
Expand Down Expand Up @@ -333,9 +322,6 @@ static int dma_trace_start(struct dma_trace_data *d)
d->dc.chan = NULL;
err = dma_copy_set_stream_tag(&d->dc, d->stream_tag);
}

/* Re-initialize the dtrace buffer */
dma_trace_buffer_init(d, NULL);
} else {
err = dma_copy_set_stream_tag(&d->dc, d->stream_tag);
}
Expand Down Expand Up @@ -445,7 +431,7 @@ int dma_trace_enable(struct dma_trace_data *d)
{
int err;

/* Allocate and initialize the dma trace buffer if needed */
/* Allocate and initialize the dma trace buffer */
err = dma_trace_buffer_alloc(d);
if (err < 0)
return err;
Expand Down

0 comments on commit 84d8153

Please sign in to comment.