Commit 247d95ee authored by Takashi Iwai's avatar Takashi Iwai

ALSA: line6: Handle error from line6_pcm_acquire()

Tested-by: default avatarChris Rorvick <chris@rorvick.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2954f914
...@@ -45,15 +45,22 @@ static int snd_line6_impulse_volume_put(struct snd_kcontrol *kcontrol, ...@@ -45,15 +45,22 @@ static int snd_line6_impulse_volume_put(struct snd_kcontrol *kcontrol,
{ {
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
int value = ucontrol->value.integer.value[0]; int value = ucontrol->value.integer.value[0];
int err;
if (line6pcm->impulse_volume == value) if (line6pcm->impulse_volume == value)
return 0; return 0;
line6pcm->impulse_volume = value; line6pcm->impulse_volume = value;
if (value > 0) if (value > 0) {
line6_pcm_acquire(line6pcm, LINE6_STREAM_IMPULSE); err = line6_pcm_acquire(line6pcm, LINE6_STREAM_IMPULSE);
else if (err < 0) {
line6pcm->impulse_volume = 0;
line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE);
return err;
}
} else {
line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE); line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE);
}
return 1; return 1;
} }
......
...@@ -182,16 +182,23 @@ static int snd_toneport_monitor_put(struct snd_kcontrol *kcontrol, ...@@ -182,16 +182,23 @@ static int snd_toneport_monitor_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
int err;
if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor) if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor)
return 0; return 0;
line6pcm->volume_monitor = ucontrol->value.integer.value[0]; line6pcm->volume_monitor = ucontrol->value.integer.value[0];
if (line6pcm->volume_monitor > 0) if (line6pcm->volume_monitor > 0) {
line6_pcm_acquire(line6pcm, LINE6_STREAM_MONITOR); err = line6_pcm_acquire(line6pcm, LINE6_STREAM_MONITOR);
else if (err < 0) {
line6pcm->volume_monitor = 0;
line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR);
return err;
}
} else {
line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR); line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR);
}
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment