diff options
author | Libin Yang <libin.yang@linux.intel.com> | 2016-06-16 11:13:25 +0800 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-06-16 10:10:12 +0200 |
commit | 960a581e22d93a784db843110ad1e6249c1542a5 (patch) | |
tree | 749416a468c7b815232ec33ac3de403953a7e74e /sound/pci/hda/hda_codec.c | |
parent | 76f64b24e692978a90d3c2e8f57f3a1f0cd7172a (diff) | |
download | linux-960a581e22d93a784db843110ad1e6249c1542a5.tar.gz linux-960a581e22d93a784db843110ad1e6249c1542a5.tar.bz2 linux-960a581e22d93a784db843110ad1e6249c1542a5.zip |
ALSA: hda: fix some klockwork scan warnings
This patch fixes some warnings from klockwork.
These warnings are not the real issues. The patch
adds the sanity check.
Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 83741887faa1..9913be8532ab 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3584,6 +3584,12 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, bool reset; spdif = snd_hda_spdif_out_of_nid(codec, nid); + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (WARN_ON(spdif == NULL)) + return; + curr_fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); reset = codec->spdif_status_reset && @@ -3768,7 +3774,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, spdif = snd_hda_spdif_out_of_nid(codec, mout->dig_out_nid); if (mout->dig_out_nid && mout->share_spdif && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { - if (chs == 2 && + if (chs == 2 && spdif != NULL && snd_hda_is_supported_format(codec, mout->dig_out_nid, format) && !(spdif->status & IEC958_AES0_NONAUDIO)) { |