Commit a72ccfba authored by Takashi Iwai's avatar Takashi Iwai

ALSA: x86: Don't return an error from chmap ctl at disconnected

It's not wise to return an error at info/get callback when
disconnected, which happens at any time.
The chmap ctl is supposed to fill zero for such a case, instead.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 18353192
...@@ -504,11 +504,6 @@ static void had_build_channel_allocation_map(struct snd_intelhad *intelhaddata) ...@@ -504,11 +504,6 @@ static void had_build_channel_allocation_map(struct snd_intelhad *intelhaddata)
static int had_chmap_ctl_info(struct snd_kcontrol *kcontrol, static int had_chmap_ctl_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
struct snd_intelhad *intelhaddata = info->private_data;
if (!intelhaddata->connected)
return -ENODEV;
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = HAD_MAX_CHANNEL; uinfo->count = HAD_MAX_CHANNEL;
uinfo->value.integer.min = 0; uinfo->value.integer.min = 0;
...@@ -524,13 +519,12 @@ static int had_chmap_ctl_get(struct snd_kcontrol *kcontrol, ...@@ -524,13 +519,12 @@ static int had_chmap_ctl_get(struct snd_kcontrol *kcontrol,
int i; int i;
const struct snd_pcm_chmap_elem *chmap; const struct snd_pcm_chmap_elem *chmap;
if (!intelhaddata->connected) memset(ucontrol->value.integer.value, 0,
return -ENODEV; sizeof(long) * HAD_MAX_CHANNEL);
mutex_lock(&intelhaddata->mutex); mutex_lock(&intelhaddata->mutex);
if (!intelhaddata->chmap->chmap) { if (!intelhaddata->chmap->chmap) {
mutex_unlock(&intelhaddata->mutex); mutex_unlock(&intelhaddata->mutex);
return -ENODATA; return 0;
} }
chmap = intelhaddata->chmap->chmap; chmap = intelhaddata->chmap->chmap;
......
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