Skip to content

Commit

Permalink
[ALSA] hda-codec - Don't create vmaster if no slaves found
Browse files Browse the repository at this point in the history
Don't create vmaster controls if no slaves are found in the given list.
This prevents the error due to an empty vmaster control.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
tiwai authored and Linus Torvalds committed Feb 22, 2008
1 parent 14c65f9 commit 2f08554
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,12 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
const char **s;
int err;

for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++)
;
if (!*s) {
snd_printdd("No slave found for %s\n", name);
return 0;
}
kctl = snd_ctl_make_virtual_master(name, tlv);
if (!kctl)
return -ENOMEM;
Expand Down

0 comments on commit 2f08554

Please sign in to comment.