diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2021-06-24 21:49:36 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-14 18:07:45 +0300 |
commit | ce2d17c9801b48364169553cd7d64d93a1f118a8 (patch) | |
tree | bc1e1fe7c8062fd9e538e3b588077bd747c3ca20 | |
parent | 1a09a37887720ddb41303c8c408c1d8e65d5c9c5 (diff) | |
download | linux-ce2d17c9801b48364169553cd7d64d93a1f118a8.tar.xz |
ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found
[ Upstream commit 0cbbeaf370221fc469c95945dd3c1198865c5fe4 ]
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: 60dd49298ec5 ("ALSA: firewire-lib: handle several AMDTP streams in callback handler of IRQ target")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | sound/firewire/amdtp-stream.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 5805c5de39fb..7a282d8e7148 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -1404,14 +1404,17 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle) unsigned int queue_size; struct amdtp_stream *s; int cycle; + bool found = false; int err; // Select an IT context as IRQ target. list_for_each_entry(s, &d->streams, list) { - if (s->direction == AMDTP_OUT_STREAM) + if (s->direction == AMDTP_OUT_STREAM) { + found = true; break; + } } - if (!s) + if (!found) return -ENXIO; d->irq_target = s; |