summaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_compat.c
diff options
context:
space:
mode:
authorJeffery Miller <jmiller@neverware.com>2018-04-20 23:20:46 -0500
committerTakashi Iwai <tiwai@suse.de>2018-04-23 08:41:35 +0200
commit912e4c332037e7ed063c164985c36fb2b549ea3a (patch)
tree36add24bfb45ba8eee0a08a37aabc9f38756037c /sound/core/pcm_compat.c
parent6d08b06e67cd117f6992c46611dfb4ce267cd71e (diff)
downloadlinux-912e4c332037e7ed063c164985c36fb2b549ea3a.tar.gz
linux-912e4c332037e7ed063c164985c36fb2b549ea3a.tar.bz2
linux-912e4c332037e7ed063c164985c36fb2b549ea3a.zip
ALSA: pcm: Return negative delays from SNDRV_PCM_IOCTL_DELAY.
The commit c2c86a97175f ("ALSA: pcm: Remove set_fs() in PCM core code") changed SNDRV_PCM_IOCTL_DELAY to return an inconsistent error instead of a negative delay. Originally the call would succeed and return the negative delay. The Chromium OS Audio Server (CRAS) gets confused and hangs when the error is returned instead of the negative delay. Help CRAS avoid the issue by rolling back the behavior to return a negative delay instead of an error. Fixes: c2c86a97175f ("ALSA: pcm: Remove set_fs() in PCM core code") Signed-off-by: Jeffery Miller <jmiller@neverware.com> Cc: <stable@vger.kernel.org> # v4.13+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_compat.c')
-rw-r--r--sound/core/pcm_compat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index b719d0bd833e..06d7c40af570 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -27,10 +27,11 @@ static int snd_pcm_ioctl_delay_compat(struct snd_pcm_substream *substream,
s32 __user *src)
{
snd_pcm_sframes_t delay;
+ int err;
- delay = snd_pcm_delay(substream);
- if (delay < 0)
- return delay;
+ err = snd_pcm_delay(substream, &delay);
+ if (err)
+ return err;
if (put_user(delay, src))
return -EFAULT;
return 0;