ALSA: hda-intel: Cleanups for widget connection list handling

This patch adds a check to snd_hda_get_connections() routine for
presence of AC_WCAP_CONN_LIST. Also, make sure that negative error
codes from noted route are handled on all places as errors.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Jaroslav Kysela
2009-07-22 16:20:40 +02:00
committed by Takashi Iwai
parent 254da007f9
commit 16a433d8b3
3 changed files with 11 additions and 9 deletions

View File

@@ -306,6 +306,12 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
if (snd_BUG_ON(!conn_list || max_conns <= 0))
return -EINVAL;
if ((get_wcaps(codec, nid) & AC_WCAP_CONN_LIST) == 0) {
snd_printk(KERN_WARNING "hda_codec: "
"connection list not available for 0x%x\n", nid);
return -EINVAL;
}
parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN);
if (parm & AC_CLIST_LONG) {
/* long form */