mirror of https://gitee.com/openkylin/linux.git
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
9d30937acc
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>
This commit is contained in:
parent
31909b83ea
commit
3c6aae4489
|
@ -316,6 +316,8 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
|
||||||
/* single connection */
|
/* single connection */
|
||||||
parm = snd_hda_codec_read(codec, nid, 0,
|
parm = snd_hda_codec_read(codec, nid, 0,
|
||||||
AC_VERB_GET_CONNECT_LIST, 0);
|
AC_VERB_GET_CONNECT_LIST, 0);
|
||||||
|
if (parm == -1 && codec->bus->rirb_error)
|
||||||
|
return -EIO;
|
||||||
conn_list[0] = parm & mask;
|
conn_list[0] = parm & mask;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -327,9 +329,12 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
|
||||||
int range_val;
|
int range_val;
|
||||||
hda_nid_t val, n;
|
hda_nid_t val, n;
|
||||||
|
|
||||||
if (i % num_elems == 0)
|
if (i % num_elems == 0) {
|
||||||
parm = snd_hda_codec_read(codec, nid, 0,
|
parm = snd_hda_codec_read(codec, nid, 0,
|
||||||
AC_VERB_GET_CONNECT_LIST, i);
|
AC_VERB_GET_CONNECT_LIST, i);
|
||||||
|
if (parm == -1 && codec->bus->rirb_error)
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
range_val = !!(parm & (1 << (shift-1))); /* ranges */
|
range_val = !!(parm & (1 << (shift-1))); /* ranges */
|
||||||
val = parm & mask;
|
val = parm & mask;
|
||||||
parm >>= shift;
|
parm >>= shift;
|
||||||
|
|
Loading…
Reference in New Issue