diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-07-22 10:20:40 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-22 10:30:03 -0400 |
commit | 16a433d8b38720a816736d59a62e705c19e31600 (patch) | |
tree | ec2efc9b071b2fc7b68d9a0278a9f64d997d7af1 /sound/pci | |
parent | 254da007f93f79ee773788cbb38f24dfab9590f5 (diff) |
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>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 8 |
3 files changed, 11 insertions, 9 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 3ecb45ddadf7..aa5540786111 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -306,6 +306,12 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, | |||
306 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) | 306 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) |
307 | return -EINVAL; | 307 | return -EINVAL; |
308 | 308 | ||
309 | if ((get_wcaps(codec, nid) & AC_WCAP_CONN_LIST) == 0) { | ||
310 | snd_printk(KERN_WARNING "hda_codec: " | ||
311 | "connection list not available for 0x%x\n", nid); | ||
312 | return -EINVAL; | ||
313 | } | ||
314 | |||
309 | parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN); | 315 | parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN); |
310 | if (parm & AC_CLIST_LONG) { | 316 | if (parm & AC_CLIST_LONG) { |
311 | /* long form */ | 317 | /* long form */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b2ea43206f18..728f2a72f9b6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4501,12 +4501,6 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4501 | &dig_nid, 1); | 4501 | &dig_nid, 1); |
4502 | if (err < 0) | 4502 | if (err < 0) |
4503 | continue; | 4503 | continue; |
4504 | if (dig_nid > 0x7f) { | ||
4505 | printk(KERN_ERR "alc880_auto: invalid dig_nid " | ||
4506 | "connection 0x%x for NID 0x%x\n", dig_nid, | ||
4507 | spec->autocfg.dig_out_pins[i]); | ||
4508 | continue; | ||
4509 | } | ||
4510 | if (!i) | 4504 | if (!i) |
4511 | spec->multiout.dig_out_nid = dig_nid; | 4505 | spec->multiout.dig_out_nid = dig_nid; |
4512 | else { | 4506 | else { |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 00c702df721c..948600dd3b90 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -3389,7 +3389,7 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) | |||
3389 | spec->mono_nid, | 3389 | spec->mono_nid, |
3390 | con_lst, | 3390 | con_lst, |
3391 | HDA_MAX_NUM_INPUTS); | 3391 | HDA_MAX_NUM_INPUTS); |
3392 | if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) | 3392 | if (num_cons <= 0 || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
3393 | return -EINVAL; | 3393 | return -EINVAL; |
3394 | 3394 | ||
3395 | for (i = 0; i < num_cons; i++) { | 3395 | for (i = 0; i < num_cons; i++) { |
@@ -3535,7 +3535,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) | |||
3535 | spec->smux_nids[0], | 3535 | spec->smux_nids[0], |
3536 | con_lst, | 3536 | con_lst, |
3537 | HDA_MAX_NUM_INPUTS); | 3537 | HDA_MAX_NUM_INPUTS); |
3538 | if (!num_cons) | 3538 | if (num_cons <= 0) |
3539 | return -EINVAL; | 3539 | return -EINVAL; |
3540 | 3540 | ||
3541 | if (!labels) | 3541 | if (!labels) |
@@ -3742,7 +3742,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3742 | if (snd_hda_get_connections(codec, | 3742 | if (snd_hda_get_connections(codec, |
3743 | spec->autocfg.mono_out_pin, conn_list, 1) && | 3743 | spec->autocfg.mono_out_pin, conn_list, 1) && |
3744 | snd_hda_get_connections(codec, conn_list[0], | 3744 | snd_hda_get_connections(codec, conn_list[0], |
3745 | conn_list, 1)) { | 3745 | conn_list, 1) > 0) { |
3746 | 3746 | ||
3747 | int wcaps = get_wcaps(codec, conn_list[0]); | 3747 | int wcaps = get_wcaps(codec, conn_list[0]); |
3748 | int wid_type = (wcaps & AC_WCAP_TYPE) | 3748 | int wid_type = (wcaps & AC_WCAP_TYPE) |
@@ -5169,6 +5169,8 @@ again: | |||
5169 | 5169 | ||
5170 | num_dacs = snd_hda_get_connections(codec, nid, | 5170 | num_dacs = snd_hda_get_connections(codec, nid, |
5171 | conn, STAC92HD83_DAC_COUNT + 1) - 1; | 5171 | conn, STAC92HD83_DAC_COUNT + 1) - 1; |
5172 | if (num_dacs < 0) | ||
5173 | num_dacs = STAC92HD83_DAC_COUNT; | ||
5172 | 5174 | ||
5173 | /* set port X to select the last DAC | 5175 | /* set port X to select the last DAC |
5174 | */ | 5176 | */ |