Skip to content

Commit

Permalink
ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STRE…
Browse files Browse the repository at this point in the history
…AM stream is found

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: 60dd492 ("ALSA: firewire-lib: handle several AMDTP streams in callback handler of IRQ target")
Signed-off-by: Christophe JAILLET <[email protected]>
Acked-by: Takashi Sakamoto <[email protected]>
Link: https://lore.kernel.org/r/9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tititiou36 authored and tiwai committed Jun 25, 2021
1 parent 5c89c2c commit 0cbbeaf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sound/firewire/amdtp-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,7 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int tx_init_skip_cycles,
unsigned int events_per_period = d->events_per_period;
unsigned int queue_size;
struct amdtp_stream *s;
bool found = false;
int err;

if (replay_seq) {
Expand All @@ -1955,10 +1956,12 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int tx_init_skip_cycles,

// 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;

Expand Down

0 comments on commit 0cbbeaf

Please sign in to comment.