mirror of
https://github.com/torvalds/linux.git
synced 2024-12-23 19:31:53 +00:00
70b20dd7f8
Commitc647f806b8
("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:c647f806b8
"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>
49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Helper functions for Dell Mic Mute LED control;
|
|
* to be included from codec driver
|
|
*/
|
|
|
|
#if IS_ENABLED(CONFIG_DELL_LAPTOP)
|
|
#include <linux/dell-led.h>
|
|
|
|
static int (*dell_micmute_led_set_func)(int);
|
|
|
|
static void dell_micmute_update(struct hda_codec *codec)
|
|
{
|
|
struct hda_gen_spec *spec = codec->spec;
|
|
|
|
dell_micmute_led_set_func(spec->micmute_led.led_value);
|
|
}
|
|
|
|
static void alc_fixup_dell_wmi(struct hda_codec *codec,
|
|
const struct hda_fixup *fix, int action)
|
|
{
|
|
bool removefunc = false;
|
|
|
|
if (action == HDA_FIXUP_ACT_PROBE) {
|
|
if (!dell_micmute_led_set_func)
|
|
dell_micmute_led_set_func = symbol_request(dell_micmute_led_set);
|
|
if (!dell_micmute_led_set_func) {
|
|
codec_warn(codec, "Failed to find dell wmi symbol dell_micmute_led_set\n");
|
|
return;
|
|
}
|
|
|
|
removefunc = (dell_micmute_led_set_func(false) < 0) ||
|
|
(snd_hda_gen_add_micmute_led(codec,
|
|
dell_micmute_update) < 0);
|
|
}
|
|
|
|
if (dell_micmute_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
|
|
symbol_put(dell_micmute_led_set);
|
|
dell_micmute_led_set_func = NULL;
|
|
}
|
|
}
|
|
|
|
#else /* CONFIG_DELL_LAPTOP */
|
|
static void alc_fixup_dell_wmi(struct hda_codec *codec,
|
|
const struct hda_fixup *fix, int action)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_DELL_LAPTOP */
|