Skip to content

Commit

Permalink
ALSA: hda - fix the 'Capture Switch' value change notifications
Browse files Browse the repository at this point in the history
[ Upstream commit a2befe9 ]

The original code in the cap_put_caller() function does not
handle correctly the positive values returned from the passed
function for multiple iterations. It means that the change
notifications may be lost.

Fixes: 352f7f9 ("ALSA: hda - Merge Realtek parser code to generic parser")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213851
Cc: <[email protected]>
Signed-off-by: Jaroslav Kysela <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
perexg authored and Sasha Levin committed Aug 26, 2021
1 parent 85e6061 commit 8fbfebe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -3458,7 +3458,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol,
struct hda_gen_spec *spec = codec->spec;
const struct hda_input_mux *imux;
struct nid_path *path;
int i, adc_idx, err = 0;
int i, adc_idx, ret, err = 0;

imux = &spec->input_mux;
adc_idx = kcontrol->id.index;
Expand All @@ -3468,9 +3468,13 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol,
if (!path || !path->ctls[type])
continue;
kcontrol->private_value = path->ctls[type];
err = func(kcontrol, ucontrol);
if (err < 0)
ret = func(kcontrol, ucontrol);
if (ret < 0) {
err = ret;
break;
}
if (ret > 0)
err = 1;
}
mutex_unlock(&codec->control_mutex);
if (err >= 0 && spec->cap_sync_hook)
Expand Down

0 comments on commit 8fbfebe

Please sign in to comment.