Commit 93bebe57 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

ALSA: hda - Check all inputs for is_active_nid_for_any()

commit 9d2b48f7 upstream.

The is_active_nid_for_any() function in the generic parser is supposed
to check all connections from/to the given widget, but the current
code checks only the first input connection (index = 0).

This patch corrects the code to check all inputs by passing -1 to
index argument.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102521Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f27db157
...@@ -671,7 +671,8 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, ...@@ -671,7 +671,8 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
} }
for (i = 0; i < path->depth; i++) { for (i = 0; i < path->depth; i++) {
if (path->path[i] == nid) { if (path->path[i] == nid) {
if (dir == HDA_OUTPUT || path->idx[i] == idx) if (dir == HDA_OUTPUT || idx == -1 ||
path->idx[i] == idx)
return true; return true;
break; break;
} }
...@@ -682,7 +683,7 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, ...@@ -682,7 +683,7 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
/* check whether the NID is referred by any active paths */ /* check whether the NID is referred by any active paths */
#define is_active_nid_for_any(codec, nid) \ #define is_active_nid_for_any(codec, nid) \
is_active_nid(codec, nid, HDA_OUTPUT, 0) is_active_nid(codec, nid, HDA_OUTPUT, -1)
/* get the default amp value for the target state */ /* get the default amp value for the target state */
static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t 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