summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_hdmi.c
diff options
context:
space:
mode:
authorAnssi Hannula2013-11-10 19:56:10 +0100
committerTakashi Iwai2013-11-11 17:07:49 +0100
commit13122e6ebf24d9f676d8a40edc2e9a265e89b628 (patch)
treee3878736f044b3237dd6c09dd2ddc6571966eaf8 /sound/pci/hda/patch_hdmi.c
parentALSA: usb: Fix wrong mapping of RLC and RRC channels (diff)
downloadkernel-qcow2-linux-13122e6ebf24d9f676d8a40edc2e9a265e89b628.tar.gz
kernel-qcow2-linux-13122e6ebf24d9f676d8a40edc2e9a265e89b628.tar.xz
kernel-qcow2-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/patch_hdmi.c')
-rw-r--r--sound/pci/hda/patch_hdmi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 8aa104cba241..08407bed093e 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1247,6 +1247,9 @@ static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
pinctl = snd_hda_codec_read(codec, pin_nid, 0,
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+ if (pinctl < 0)
+ return hbr ? -EINVAL : 0;
+
new_pinctl = pinctl & ~AC_PINCTL_EPT;
if (hbr)
new_pinctl |= AC_PINCTL_EPT_HBR;
@@ -3091,7 +3094,7 @@ static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
int hbr_ctl, hbr_ctl_new;
hbr_ctl = snd_hda_codec_read(codec, pin_nid, 0, ATI_VERB_GET_HBR_CONTROL, 0);
- if (hbr_ctl & ATI_HBR_CAPABLE) {
+ if (hbr_ctl >= 0 && (hbr_ctl & ATI_HBR_CAPABLE)) {
if (hbr)
hbr_ctl_new = hbr_ctl | ATI_HBR_ENABLE;
else