diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-01-13 10:19:32 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-01-21 16:40:19 +0100 |
commit | 7df5a5f66b8fc2cd51649b3f1b0b88dc59c49d2d (patch) | |
tree | b3da6be38e7fa4f7851a8709e8ce4236348ff356 /sound/core | |
parent | ALSA: pcm: Make PCM linked list consistent while re-grouping (diff) | |
download | linux-7df5a5f66b8fc2cd51649b3f1b0b88dc59c49d2d.tar.xz linux-7df5a5f66b8fc2cd51649b3f1b0b88dc59c49d2d.zip |
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 <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_native.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 1a56bb1ad780..fb45386270d5 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2023,7 +2023,6 @@ static void relink_to_local(struct snd_pcm_substream *substream) static int snd_pcm_unlink(struct snd_pcm_substream *substream) { - struct snd_pcm_substream *s; struct snd_pcm_group *group; int res = 0; @@ -2040,10 +2039,9 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream) /* detach the last stream, too */ if (list_is_singular(&group->substreams)) { - snd_pcm_group_for_each_entry(s, substream) { - relink_to_local(s); - break; - } + relink_to_local(list_first_entry(&group->substreams, + struct snd_pcm_substream, + link_list)); kfree(group); } |