diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-27 16:42:14 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-28 07:22:57 +0100 |
commit | 247d95ee6dd22e5323ecf7a73ff64110ef2fa2da (patch) | |
tree | 854cfaf76c2069ef4eeaee444095eee526d30b95 /sound/usb/line6/pcm.c | |
parent | 2954f914f2816738b800be7909b771f30bf6a856 (diff) |
ALSA: line6: Handle error from line6_pcm_acquire()
Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6/pcm.c')
-rw-r--r-- | sound/usb/line6/pcm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c index 73c87467d2e0..8461d6bf992f 100644 --- a/sound/usb/line6/pcm.c +++ b/sound/usb/line6/pcm.c @@ -45,15 +45,22 @@ static int snd_line6_impulse_volume_put(struct snd_kcontrol *kcontrol, { struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); int value = ucontrol->value.integer.value[0]; + int err; if (line6pcm->impulse_volume == value) return 0; line6pcm->impulse_volume = value; - if (value > 0) - line6_pcm_acquire(line6pcm, LINE6_STREAM_IMPULSE); - else + if (value > 0) { + err = line6_pcm_acquire(line6pcm, LINE6_STREAM_IMPULSE); + if (err < 0) { + line6pcm->impulse_volume = 0; + line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE); + return err; + } + } else { line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE); + } return 1; } |