Skip to content

Commit

Permalink
audio: host-zephyr: remove redundant return
Browse files Browse the repository at this point in the history
there are two return in common update, remove the first
to save cycles, test platform is tgl board with debug sof
build, it can save cycles from 455 to 452.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
  • Loading branch information
btian1 authored and kv2019i committed Sep 15, 2023
1 parent 036da2a commit dd2a64b
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/audio/host-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void host_common_update(struct host_data *hd, struct comp_dev *dev, uint32_t byt
bool update_mailbox = false;
bool send_ipc = false;

if (hd->ipc_host.direction == SOF_IPC_STREAM_PLAYBACK) {
if (dev->direction == SOF_IPC_STREAM_PLAYBACK) {
source = buffer_acquire(hd->dma_buffer);
sink = buffer_acquire(hd->local_buffer);
ret = dma_buffer_copy_from(source, sink, hd->process, bytes);
Expand All @@ -257,20 +257,14 @@ void host_common_update(struct host_data *hd, struct comp_dev *dev, uint32_t byt
ret = dma_buffer_copy_to(source, sink, hd->process, bytes);
}

/* assert dma_buffer_copy succeed */
if (ret < 0)
comp_err(dev, "host_common_update() dma buffer copy failed, dir %d bytes %d avail %d free %d",
hd->ipc_host.direction, bytes,
audio_stream_get_avail_samples(&source->stream) *
audio_stream_frame_bytes(&source->stream),
audio_stream_get_free_samples(&sink->stream) *
audio_stream_frame_bytes(&sink->stream));

buffer_release(sink);
buffer_release(source);

if (ret < 0)
if (ret < 0) {
comp_err(dev, "host_common_update() copy failed, dir %d bytes %d return: %d",
dev->direction, bytes, ret);
return;
}

hd->total_data_processed += bytes;

Expand Down

0 comments on commit dd2a64b

Please sign in to comment.