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>
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 3ecb45d..aa55407 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -306,6 +306,12 @@
 	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 */