Commit dca008f3 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] hda-codec - Don't query widget parameter for invalid NID

Don't query a widget parameter for an invalid NID in get_wcaps() but
rather returns zero (i.e. no attribute).
The read to an non-existing widget may result in a fatal codec
communication error.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 0ef6ce7b
......@@ -370,7 +370,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
{
if (nid < codec->start_nid ||
nid >= codec->start_nid + codec->num_nodes)
return snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
return 0;
return codec->wcaps[nid - codec->start_nid];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment