OSDN Git Service

pcm: plugin status - fix the return value (regression)
authorJaroslav Kysela <perex@perex.cz>
Wed, 30 Dec 2020 08:31:10 +0000 (09:31 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 30 Dec 2020 08:38:04 +0000 (09:38 +0100)
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: 4f90392f07e ("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>
src/pcm/pcm_plugin.c

index 5739cfc..76a524f 100644 (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;
 }