From: Jaroslav Kysela Date: Tue, 25 May 2021 13:29:22 +0000 (+0200) Subject: pcm: hw - fix snd_pcm_hw_state() X-Git-Tag: v1.2.5~7 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2c8e31f50906fb51bcd16336886dc1b77b1208c8;p=alsa-lib.git pcm: hw - fix snd_pcm_hw_state() The pcm status function should not return an error code. Return always only the mmaped status. Fixes: https://github.com/alsa-project/alsa-lib/issues/137 Signed-off-by: Jaroslav Kysela --- diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 6382b7a0..b38dcb5f 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -600,9 +600,9 @@ static int snd_pcm_hw_status(snd_pcm_t *pcm, snd_pcm_status_t * status) static snd_pcm_state_t snd_pcm_hw_state(snd_pcm_t *pcm) { snd_pcm_hw_t *hw = pcm->private_data; - int err = query_status_data(hw); - if (err < 0) - return err; + /* no error checking, the mmap state should be correct + * after SNDRV_PCM_IOCTL_SYNC_PTR */ + query_status_data(hw); return (snd_pcm_state_t) hw->mmap_status->state; }