diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-27 10:42:14 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-28 01:22:57 -0500 |
commit | 247d95ee6dd22e5323ecf7a73ff64110ef2fa2da (patch) | |
tree | 854cfaf76c2069ef4eeaee444095eee526d30b95 /sound/usb/line6 | |
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')
-rw-r--r-- | sound/usb/line6/pcm.c | 13 | ||||
-rw-r--r-- | sound/usb/line6/toneport.c | 13 |
2 files changed, 20 insertions, 6 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, | |||
45 | { | 45 | { |
46 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | 46 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); |
47 | int value = ucontrol->value.integer.value[0]; | 47 | int value = ucontrol->value.integer.value[0]; |
48 | int err; | ||
48 | 49 | ||
49 | if (line6pcm->impulse_volume == value) | 50 | if (line6pcm->impulse_volume == value) |
50 | return 0; | 51 | return 0; |
51 | 52 | ||
52 | line6pcm->impulse_volume = value; | 53 | line6pcm->impulse_volume = value; |
53 | if (value > 0) | 54 | if (value > 0) { |
54 | line6_pcm_acquire(line6pcm, LINE6_STREAM_IMPULSE); | 55 | err = line6_pcm_acquire(line6pcm, LINE6_STREAM_IMPULSE); |
55 | else | 56 | if (err < 0) { |
57 | line6pcm->impulse_volume = 0; | ||
58 | line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE); | ||
59 | return err; | ||
60 | } | ||
61 | } else { | ||
56 | line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE); | 62 | line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE); |
63 | } | ||
57 | return 1; | 64 | return 1; |
58 | } | 65 | } |
59 | 66 | ||
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c index 61fa6256d7b0..819e06b3f3db 100644 --- a/sound/usb/line6/toneport.c +++ b/sound/usb/line6/toneport.c | |||
@@ -182,16 +182,23 @@ static int snd_toneport_monitor_put(struct snd_kcontrol *kcontrol, | |||
182 | struct snd_ctl_elem_value *ucontrol) | 182 | struct snd_ctl_elem_value *ucontrol) |
183 | { | 183 | { |
184 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | 184 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); |
185 | int err; | ||
185 | 186 | ||
186 | if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor) | 187 | if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor) |
187 | return 0; | 188 | return 0; |
188 | 189 | ||
189 | line6pcm->volume_monitor = ucontrol->value.integer.value[0]; | 190 | line6pcm->volume_monitor = ucontrol->value.integer.value[0]; |
190 | 191 | ||
191 | if (line6pcm->volume_monitor > 0) | 192 | if (line6pcm->volume_monitor > 0) { |
192 | line6_pcm_acquire(line6pcm, LINE6_STREAM_MONITOR); | 193 | err = line6_pcm_acquire(line6pcm, LINE6_STREAM_MONITOR); |
193 | else | 194 | if (err < 0) { |
195 | line6pcm->volume_monitor = 0; | ||
196 | line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR); | ||
197 | return err; | ||
198 | } | ||
199 | } else { | ||
194 | line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR); | 200 | line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR); |
201 | } | ||
195 | 202 | ||
196 | return 1; | 203 | return 1; |
197 | } | 204 | } |