mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
ALSA: compress: fix the states to check for allowing read
for reading compressed data, we need to allow when we are paused, draining or stopped. Signed-off-by: Vinod Koul <vinod.koul@intel.com> Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Cc: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
a555bb8c6b
commit
754813473c
1 changed files with 10 additions and 2 deletions
|
@ -311,8 +311,16 @@ static ssize_t snd_compr_read(struct file *f, char __user *buf,
|
|||
stream = &data->stream;
|
||||
mutex_lock(&stream->device->lock);
|
||||
|
||||
/* read is allowed when stream is running */
|
||||
if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
|
||||
/* read is allowed when stream is running, paused, draining and setup
|
||||
* (yes setup is state which we transition to after stop, so if user
|
||||
* wants to read data after stop we allow that)
|
||||
*/
|
||||
switch (stream->runtime->state) {
|
||||
case SNDRV_PCM_STATE_OPEN:
|
||||
case SNDRV_PCM_STATE_PREPARED:
|
||||
case SNDRV_PCM_STATE_XRUN:
|
||||
case SNDRV_PCM_STATE_SUSPENDED:
|
||||
case SNDRV_PCM_STATE_DISCONNECTED:
|
||||
retval = -EBADFD;
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue