From: Timo Wischer Date: Wed, 4 Jul 2018 13:39:49 +0000 (+0200) Subject: pcm: rate: Add error check for snd_pcm_avail_update() X-Git-Tag: v1.1.7~20 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2c04ea1f297a9a7513ee8107cce1568c9bfc52aa;p=alsa-lib.git pcm: rate: Add error check for snd_pcm_avail_update() Without these changes a negative error code returned by snd_pcm_avail_update() will be not handled correctly. With this patch the returned error code of snd_pcm_avail_update() will be returned by snd_pcm_rate_avail_update(). Signed-off-by: Timo Wischer Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 4e0c7ca7..031a43dc 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -970,9 +970,12 @@ static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm) { snd_pcm_rate_t *rate = pcm->private_data; snd_pcm_t *slave = rate->gen.slave; - snd_pcm_uframes_t slave_size; + snd_pcm_sframes_t slave_size; slave_size = snd_pcm_avail_update(slave); + if (slave_size < 0) + return slave_size; + if (pcm->stream == SND_PCM_STREAM_CAPTURE) goto _capture; snd_pcm_rate_sync_hwptr(pcm);