pcm: fix __snd_pcm_state() return value

The __snd_pcm_state() must return a valid state, not an error value
when the plugin callback is not defined. Use the first state
SND_PCM_STATE_OPEN - the other functions will return the error
code depending on this state.

Link: https://lore.kernel.org/alsa-devel/20201226213547.175071-10-alexhenrie24@gmail.com/
Reported-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-12-27 13:29:33 +01:00
parent 9ebd29d2d3
commit 36aff79747

View file

@ -444,7 +444,7 @@ static inline int __snd_pcm_start(snd_pcm_t *pcm)
static inline snd_pcm_state_t __snd_pcm_state(snd_pcm_t *pcm)
{
if (!pcm->fast_ops->state)
return -ENOSYS;
return SND_PCM_STATE_OPEN;
return pcm->fast_ops->state(pcm->fast_op_arg);
}