diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-02-15 15:45:06 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-02-16 03:22:43 -0500 |
commit | a72ccfbad7fd6f604d8edd068119edb57e7984e1 (patch) | |
tree | d0edf7354280a155371889778a7f1a7f50e7ee53 /sound/x86 | |
parent | 18353192b8f696a27420e2e8f39804c2075f26fb (diff) |
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: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/x86')
-rw-r--r-- | sound/x86/intel_hdmi_audio.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index 5f2445389716..71f01204a590 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c | |||
@@ -504,11 +504,6 @@ static void had_build_channel_allocation_map(struct snd_intelhad *intelhaddata) | |||
504 | static int had_chmap_ctl_info(struct snd_kcontrol *kcontrol, | 504 | static int had_chmap_ctl_info(struct snd_kcontrol *kcontrol, |
505 | struct snd_ctl_elem_info *uinfo) | 505 | struct snd_ctl_elem_info *uinfo) |
506 | { | 506 | { |
507 | struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); | ||
508 | struct snd_intelhad *intelhaddata = info->private_data; | ||
509 | |||
510 | if (!intelhaddata->connected) | ||
511 | return -ENODEV; | ||
512 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 507 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
513 | uinfo->count = HAD_MAX_CHANNEL; | 508 | uinfo->count = HAD_MAX_CHANNEL; |
514 | uinfo->value.integer.min = 0; | 509 | uinfo->value.integer.min = 0; |
@@ -524,13 +519,12 @@ static int had_chmap_ctl_get(struct snd_kcontrol *kcontrol, | |||
524 | int i; | 519 | int i; |
525 | const struct snd_pcm_chmap_elem *chmap; | 520 | const struct snd_pcm_chmap_elem *chmap; |
526 | 521 | ||
527 | if (!intelhaddata->connected) | 522 | memset(ucontrol->value.integer.value, 0, |
528 | return -ENODEV; | 523 | sizeof(long) * HAD_MAX_CHANNEL); |
529 | |||
530 | mutex_lock(&intelhaddata->mutex); | 524 | mutex_lock(&intelhaddata->mutex); |
531 | if (!intelhaddata->chmap->chmap) { | 525 | if (!intelhaddata->chmap->chmap) { |
532 | mutex_unlock(&intelhaddata->mutex); | 526 | mutex_unlock(&intelhaddata->mutex); |
533 | return -ENODATA; | 527 | return 0; |
534 | } | 528 | } |
535 | 529 | ||
536 | chmap = intelhaddata->chmap->chmap; | 530 | chmap = intelhaddata->chmap->chmap; |