* [PATCH] ALSA: hda - fix the 'Capture Switch' value change notifications
@ 2021-08-11 16:14 Jaroslav Kysela
2021-08-12 11:39 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Jaroslav Kysela @ 2021-08-11 16:14 UTC (permalink / raw)
To: ALSA development; +Cc: Takashi Iwai, stable
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: 352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213851
Cc: <stable@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
sound/pci/hda/hda_generic.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index e97d00585e8e..481d8f8d3396 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -3460,7 +3460,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;
@@ -3470,9 +3470,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)
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: hda - fix the 'Capture Switch' value change notifications
2021-08-11 16:14 [PATCH] ALSA: hda - fix the 'Capture Switch' value change notifications Jaroslav Kysela
@ 2021-08-12 11:39 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-08-12 11:39 UTC (permalink / raw)
To: Jaroslav Kysela; +Cc: ALSA development, stable
On Wed, 11 Aug 2021 18:14:41 +0200,
Jaroslav Kysela wrote:
>
> 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: 352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser")
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213851
> Cc: <stable@kernel.org>
> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-12 11:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 16:14 [PATCH] ALSA: hda - fix the 'Capture Switch' value change notifications Jaroslav Kysela
2021-08-12 11:39 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.