ALSA: hda_generic: do not read connections for widged with an unknown type
Reading node connections for an unknown widget can confuse HDA codec bus. Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
1c20930a41
commit
0529604838
@ -121,11 +121,17 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
|
|||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
node->nid = nid;
|
node->nid = nid;
|
||||||
nconns = snd_hda_get_connections(codec, nid, conn_list,
|
node->wid_caps = get_wcaps(codec, nid);
|
||||||
HDA_MAX_CONNECTIONS);
|
node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
|
||||||
if (nconns < 0) {
|
if (node->type <= AC_WID_BEEP || node->type == AC_WID_VENDOR) {
|
||||||
kfree(node);
|
nconns = snd_hda_get_connections(codec, nid, conn_list,
|
||||||
return nconns;
|
HDA_MAX_CONNECTIONS);
|
||||||
|
if (nconns < 0) {
|
||||||
|
kfree(node);
|
||||||
|
return nconns;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nconns = 0;
|
||||||
}
|
}
|
||||||
if (nconns <= ARRAY_SIZE(node->slist))
|
if (nconns <= ARRAY_SIZE(node->slist))
|
||||||
node->conn_list = node->slist;
|
node->conn_list = node->slist;
|
||||||
@ -140,8 +146,6 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
|
|||||||
}
|
}
|
||||||
memcpy(node->conn_list, conn_list, nconns * sizeof(hda_nid_t));
|
memcpy(node->conn_list, conn_list, nconns * sizeof(hda_nid_t));
|
||||||
node->nconns = nconns;
|
node->nconns = nconns;
|
||||||
node->wid_caps = get_wcaps(codec, nid);
|
|
||||||
node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
|
|
||||||
|
|
||||||
if (node->type == AC_WID_PIN) {
|
if (node->type == AC_WID_PIN) {
|
||||||
node->pin_caps = snd_hda_query_pin_caps(codec, node->nid);
|
node->pin_caps = snd_hda_query_pin_caps(codec, node->nid);
|
||||||
|
Loading…
Reference in New Issue
Block a user