Skip to content

Commit 7df5a5f

Browse files
committed
ALSA: pcm: Avoid confusing loop in snd_pcm_unlink()
The snd_pcm_group_for_each_entry() loop found in snd_pcm_unlink() is only for taking the first list entry. Use list_first_entry() to make clearer. Signed-off-by: Takashi Iwai <[email protected]>
1 parent a41c4cb commit 7df5a5f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sound/core/pcm_native.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,6 @@ static void relink_to_local(struct snd_pcm_substream *substream)
20232023

20242024
static int snd_pcm_unlink(struct snd_pcm_substream *substream)
20252025
{
2026-
struct snd_pcm_substream *s;
20272026
struct snd_pcm_group *group;
20282027
int res = 0;
20292028

@@ -2040,10 +2039,9 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream)
20402039

20412040
/* detach the last stream, too */
20422041
if (list_is_singular(&group->substreams)) {
2043-
snd_pcm_group_for_each_entry(s, substream) {
2044-
relink_to_local(s);
2045-
break;
2046-
}
2042+
relink_to_local(list_first_entry(&group->substreams,
2043+
struct snd_pcm_substream,
2044+
link_list));
20472045
kfree(group);
20482046
}
20492047

0 commit comments

Comments
 (0)