From: Jaroslav Kysela Date: Mon, 27 May 2019 18:10:32 +0000 (+0200) Subject: pcm_file: another locking fix (coverity) X-Git-Tag: v1.2.1~55 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=ac6df1106c314de5d027176d910b9bc43a1fa7f9;p=alsa-lib.git pcm_file: another locking fix (coverity) Signed-off-by: Jaroslav Kysela --- diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 54142a3d..1ef80b59 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -612,18 +612,16 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm snd_pcm_channel_area_t areas[pcm->channels]; snd_pcm_sframes_t frames; - __snd_pcm_lock(pcm); frames = _snd_pcm_readn(file->gen.slave, bufs, size); - if (frames <= 0) { - __snd_pcm_unlock(pcm); + if (frames <= 0) return frames; - } snd_pcm_areas_from_bufs(pcm, areas, bufs); snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); + __snd_pcm_lock(pcm); snd_pcm_file_add_frames(pcm, areas, 0, frames); - __snd_pcm_unlock(pcm); + return frames; }