From: Takashi Iwai <tiwai@suse.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: clemens@ladisch.de, o-takashi@sakamocchi.jp, perex@perex.cz,
tiwai@suse.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found
Date: Fri, 25 Jun 2021 09:38:27 +0200 [thread overview]
Message-ID: <s5hfsx6l7gs.wl-tiwai@suse.de> (raw)
In-Reply-To: <9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.fr>
On Thu, 24 Jun 2021 20:49:36 +0200,
Christophe JAILLET wrote:
>
> 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>
Applied now. Thanks.
Takashi
> ---
> We could test with" if (list_entry_is_head(s, &d->streams, list))"
> instead, but I find it much less readable.
> ---
> sound/firewire/amdtp-stream.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
> index aad9778d1c4d..9be2260e4ca2 100644
> --- a/sound/firewire/amdtp-stream.c
> +++ b/sound/firewire/amdtp-stream.c
> @@ -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) {
> @@ -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;
>
> --
> 2.30.2
>
prev parent reply other threads:[~2021-06-25 7:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 18:49 [PATCH] ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found Christophe JAILLET
2021-06-24 21:05 ` Takashi Sakamoto
2021-06-25 9:05 ` Dan Carpenter
2021-06-25 7:38 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hfsx6l7gs.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=clemens@ladisch.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox