Skip to content

Commit c81c7bf

Browse files
marc-hbkeyonjie
authored andcommitted
Revert "dma-trace: add check to avoid dereference from NULL"
This reverts commit 89ec377. As commit 7df3674 ("trace: enable trace after it is ready") is reverted this is not required anymore. See long previous commit message. Signed-off-by: Marc Herbert <marc.herbert@intel.com> (cherry picked from commit a487ca9)
1 parent 5dd268e commit c81c7bf

4 files changed

Lines changed: 7 additions & 14 deletions

File tree

src/ipc/dma-copy.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ int dma_copy_to_host_nowait(struct dma_copy *dc, struct dma_sg_config *host_sg,
6464
{
6565
int ret;
6666

67-
/* return if DMA channel is not get yet */
68-
if (!dc->chan)
69-
return -EINVAL;
70-
7167
/* tell gateway to copy */
7268
ret = dma_copy(dc->chan, size, 0);
7369
if (ret < 0)
@@ -89,10 +85,6 @@ int dma_copy_to_host_nowait(struct dma_copy *dc, struct dma_sg_config *host_sg,
8985
int32_t err;
9086
int32_t offset = host_offset;
9187

92-
/* return if DMA channel is not get yet */
93-
if (!dc->chan)
94-
return -EINVAL;
95-
9688
if (size <= 0)
9789
return 0;
9890

src/platform/intel/cavs/platform.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,7 @@ int platform_init(struct sof *sof)
524524
#elif CONFIG_TRACE
525525
/* Initialize DMA for Trace*/
526526
trace_point(TRACE_BOOT_PLATFORM_DMA_TRACE);
527-
ret = dma_trace_init_complete(sof->dmat);
528-
if (ret < 0)
529-
return ret;
527+
dma_trace_init_complete(sof->dmat);
530528
#endif
531529

532530
/* show heap status */

src/trace/dma-trace.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,9 @@ void dma_trace_on(void)
492492
{
493493
struct dma_trace_data *trace_data = dma_trace_data_get();
494494

495-
if (!trace_data || trace_data->enabled)
495+
if (trace_data->enabled) {
496496
return;
497+
}
497498

498499
trace_data->enabled = 1;
499500
schedule_task(&trace_data->dmat_work, DMA_TRACE_PERIOD,
@@ -505,8 +506,9 @@ void dma_trace_off(void)
505506
{
506507
struct dma_trace_data *trace_data = dma_trace_data_get();
507508

508-
if (!trace_data || !trace_data->enabled)
509+
if (!trace_data->enabled) {
509510
return;
511+
}
510512

511513
schedule_task_cancel(&trace_data->dmat_work);
512514
trace_data->enabled = 0;

src/trace/trace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ void trace_log_unfiltered(bool send_atomic, const void *log_entry, const struct
272272
struct trace *trace = trace_get();
273273
va_list vl;
274274

275-
if (!trace || !trace->enable)
275+
if (!trace->enable) {
276276
return;
277+
}
277278

278279
va_start(vl, arg_count);
279280
vatrace_log(send_atomic, (uint32_t)log_entry, ctx, lvl, id_1, id_2, arg_count, vl);

0 commit comments

Comments
 (0)