Blob Blame History Raw
From 70b20dd7f897c6c14ab9e0d8400aed520ab5f09b Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Wed, 15 Aug 2018 19:08:10 -0700
Subject: [PATCH] ALSA: update dell-wmi mic-mute registration to new world order
Git-commit: 70b20dd7f897c6c14ab9e0d8400aed520ab5f09b
Patch-mainline: v4.19-rc1
References: bsc#1121278

Commit c647f806b8c2 ("ALSA: hda - Allow multiple ADCs for mic mute LED
controls") changed the return value of the snd_hda_gen_add_micmute_led()
without actually updating the callers.

Admittedly, almost no callers actually cared about the return value.
But one call site very much did: the Dell wmi code.  It would see the
registration return zero, which _used_ to mean "failed" but now means
"success", and clear the dell_micmute_led_set_func pointer.

End result: the successful registration would end up calling the Dell
code that thought it had all failed, and call through a NULL pointer.

To make matters worse, it ends up being a tail-call, and with the
retpoline sequence you don't even see the caller (dell_micmute_update())
in the stack trace, so the error ended up way less obvious than it
should have been.

Fixes: c647f806b8c2 "ALSA: hda - Allow multiple ADCs for mic mute LED controls"
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/dell_wmi_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/dell_wmi_helper.c b/sound/pci/hda/dell_wmi_helper.c
index 8a7dbd1a7fbf..bbd6c87a4ed6 100644
--- a/sound/pci/hda/dell_wmi_helper.c
+++ b/sound/pci/hda/dell_wmi_helper.c
@@ -30,7 +30,7 @@ static void alc_fixup_dell_wmi(struct hda_codec *codec,
 
 		removefunc = (dell_micmute_led_set_func(false) < 0) ||
 			(snd_hda_gen_add_micmute_led(codec,
-						     dell_micmute_update) <= 0);
+						     dell_micmute_update) < 0);
 	}
 
 	if (dell_micmute_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
-- 
2.20.1