From ac6df1106c314de5d027176d910b9bc43a1fa7f9 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 27 May 2019 20:10:32 +0200
Subject: [PATCH 24/25] pcm_file: another locking fix (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/pcm/pcm_file.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c
index 54142a3d16ef..1ef80b599b06 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;
}
--
2.16.4