aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-07-10 06:52:27 -0400
committerTakashi Iwai <tiwai@suse.de>2009-07-10 06:56:41 -0400
commit3c6aae4489e7c05f3685e9eaa538249be7c79ebe (patch)
tree95d1db12b1668da922684d45acd156fe308ca35f /sound/pci
parent31909b83ea5b4035ce129bb0df622ec2d2fb3e96 (diff)
ALSA: hda - Check codec errors in snd_hda_get_connections()
The codec read errors in snd_hda_get_connections() are ignored so far, and it causes a problem like the bug in the commit 9d30937accf2c01e8b0bd59787409a7348cbbcb7 ALSA: hda_intel: more strict alc880_parse_auto_config dig_nid checking Better to check errors in the function and returns a proper error code rather than passing bogus NID values. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 94d848e98716..ec352c6ae49a 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -316,6 +316,8 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
316 /* single connection */ 316 /* single connection */
317 parm = snd_hda_codec_read(codec, nid, 0, 317 parm = snd_hda_codec_read(codec, nid, 0,
318 AC_VERB_GET_CONNECT_LIST, 0); 318 AC_VERB_GET_CONNECT_LIST, 0);
319 if (parm == -1 && codec->bus->rirb_error)
320 return -EIO;
319 conn_list[0] = parm & mask; 321 conn_list[0] = parm & mask;
320 return 1; 322 return 1;
321 } 323 }
@@ -327,9 +329,12 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
327 int range_val; 329 int range_val;
328 hda_nid_t val, n; 330 hda_nid_t val, n;
329 331
330 if (i % num_elems == 0) 332 if (i % num_elems == 0) {
331 parm = snd_hda_codec_read(codec, nid, 0, 333 parm = snd_hda_codec_read(codec, nid, 0,
332 AC_VERB_GET_CONNECT_LIST, i); 334 AC_VERB_GET_CONNECT_LIST, i);
335 if (parm == -1 && codec->bus->rirb_error)
336 return -EIO;
337 }
333 range_val = !!(parm & (1 << (shift-1))); /* ranges */ 338 range_val = !!(parm & (1 << (shift-1))); /* ranges */
334 val = parm & mask; 339 val = parm & mask;
335 parm >>= shift; 340 parm >>= shift;