From 96ba1625dc19651e85184509fe45b9b65f9fa119 Mon Sep 17 00:00:00 2001 From: Vignesh Kulothungan Date: Thu, 4 Jan 2018 13:49:12 -0800 Subject: [PATCH] dsp: Avoid excessive list iterations Exit list iteration after the required conditions for the loop has been satisfied to avoid additional list iteration. Change-Id: I96872d3be469420e613ec0244588a0a8ecb50e58 Signed-off-by: Vignesh Kulothungan --- dsp/q6asm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dsp/q6asm.c b/dsp/q6asm.c index 0569d1572bec..38f34a73f9d5 100644 --- a/dsp/q6asm.c +++ b/dsp/q6asm.c @@ -8284,8 +8284,10 @@ static int __q6asm_read(struct audio_client *ac, bool is_custom_len_reqd, list_for_each_safe(ptr, next, &ac->port[OUT].mem_map_handle) { buf_node = list_entry(ptr, struct asm_buffer_node, list); - if (buf_node->buf_phys_addr == ab->phys) + if (buf_node->buf_phys_addr == ab->phys) { read.mem_map_handle = buf_node->mmap_hdl; + break; + } } dev_vdbg(ac->dev, "memory_map handle in q6asm_read: [%0x]:", read.mem_map_handle);