Skip to content

Commit ee2dd70

Browse files
ossilatortiwai
authored andcommitted
ALSA: pcm: use exit controlled loop in snd_pcm_playback_silence()
We already know that `frames` is greater than zero, because we just checked it. So we don't need to check the loop condition on the first iteration. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Link: https://lore.kernel.org/r/20230505155244.2312199-7-oswald.buddenhagen@gmx.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 6ffa6f3 commit ee2dd70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/core/pcm_lib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
123123
if (frames == 0)
124124
return;
125125
ofs = (runtime->silence_start + runtime->silence_filled) % runtime->buffer_size;
126-
while (frames > 0) {
126+
do {
127127
transfer = ofs + frames > runtime->buffer_size ? runtime->buffer_size - ofs : frames;
128128
err = fill_silence_frames(substream, ofs, transfer);
129129
snd_BUG_ON(err < 0);
130130
runtime->silence_filled += transfer;
131131
frames -= transfer;
132132
ofs = 0;
133-
}
133+
} while (frames > 0);
134134
snd_pcm_dma_buffer_sync(substream, SNDRV_DMA_SYNC_DEVICE);
135135
}
136136

0 commit comments

Comments
 (0)