pcm: plugin status - fix the return value (regression)

The snd_pcm_plugin_avail_update() error code in snd_pcm_plugin_status()
should not be reported to the caller. The state errors can be determined
using the state member in the status structure.

Fixes: 4f90392f07 ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
BugLink: https://github.com/alsa-project/alsa-lib/issues/107
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-12-30 09:31:10 +01:00
parent 6c24cd2e60
commit afe6ff3b33

View file

@ -541,19 +541,17 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
snd_pcm_sframes_t err, avail;
snd_pcm_sframes_t err;
/* sync with the latest hw and appl ptrs */
avail = snd_pcm_plugin_avail_update(pcm);
if (avail < 0)
return avail;
snd_pcm_plugin_avail_update(pcm);
err = snd_pcm_status(plugin->gen.slave, status);
if (err < 0)
return err;
status->appl_ptr = *pcm->appl.ptr;
status->hw_ptr = *pcm->hw.ptr;
status->avail = avail;
status->avail = snd_pcm_mmap_avail(pcm);
status->delay = snd_pcm_mmap_delay(pcm);
return 0;
}