提交 a9e8908d 编写于 作者: C Christophe JAILLET 提交者: Zheng Zengkai

ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found

stable inclusion
from stable-5.10.50
commit dd6d4e92e7240ed92583eacf097289a13d971d73
bugzilla: 174522 https://gitee.com/openeuler/kernel/issues/I4DNFY

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=dd6d4e92e7240ed92583eacf097289a13d971d73

--------------------------------

[ Upstream commit 0cbbeaf3 ]

The intent here is to return an error code if we don't find what we are
looking for in the 'list_for_each_entry()' loop.

's' is not NULL if the list is empty or if we scan the complete list.
Introduce a new 'found' variable to handle such cases.

Fixes: 60dd4929 ("ALSA: firewire-lib: handle several AMDTP streams in callback handler of IRQ target")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.frSigned-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ebf32873
...@@ -1404,14 +1404,17 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle) ...@@ -1404,14 +1404,17 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle)
unsigned int queue_size; unsigned int queue_size;
struct amdtp_stream *s; struct amdtp_stream *s;
int cycle; int cycle;
bool found = false;
int err; int err;
// Select an IT context as IRQ target. // Select an IT context as IRQ target.
list_for_each_entry(s, &d->streams, list) { list_for_each_entry(s, &d->streams, list) {
if (s->direction == AMDTP_OUT_STREAM) if (s->direction == AMDTP_OUT_STREAM) {
found = true;
break; break;
}
} }
if (!s) if (!found)
return -ENXIO; return -ENXIO;
d->irq_target = s; d->irq_target = s;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册