diff options
author | Anssi Hannula <anssi.hannula@iki.fi> | 2013-11-10 20:56:10 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-11-11 17:07:49 +0100 |
commit | 13122e6ebf24d9f676d8a40edc2e9a265e89b628 (patch) | |
tree | e3878736f044b3237dd6c09dd2ddc6571966eaf8 /sound/pci/hda/hda_eld.c | |
parent | 71373fddf6dff7cf5e67923e6837fc4de28478ff (diff) | |
download | linux-13122e6ebf24d9f676d8a40edc2e9a265e89b628.tar.gz linux-13122e6ebf24d9f676d8a40edc2e9a265e89b628.tar.bz2 linux-13122e6ebf24d9f676d8a40edc2e9a265e89b628.zip |
ALSA: hda - hdmi: Add error-checking to some codec reads
Add error checks to HBR status reads (both generic and ATI/AMD) and
ATI/AMD codec reads for ELD generation.
Unchecked errors in these just caused more errors later on (invalid
codec writes for the HBR ones and ELD parsing errors for the ATI/AMD ELD
ones), but it is better to catch them earlier.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r-- | sound/pci/hda/hda_eld.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 32d3e3855a6e..e8c55f5a34ff 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c @@ -680,7 +680,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid, spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0); - if (!spkalloc) { + if (spkalloc <= 0) { snd_printd(KERN_INFO "HDMI ATI/AMD: no speaker allocation for ELD\n"); return -EINVAL; } @@ -742,6 +742,9 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid, snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3); ati_sad = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_DESCRIPTOR, 0); + if (ati_sad <= 0) + continue; + if (ati_sad & ATI_AUDIODESC_RATES) { /* format is supported, copy SAD as-is */ buf[pos++] = (ati_sad & 0x0000ff) >> 0; |