Skip to content

Commit

Permalink
ALSA: hda - Fix incorrect clearance of thinkpad_acpi hooks
Browse files Browse the repository at this point in the history
Since the commit c647f80 ("ALSA: hda - Allow multiple ADCs for
mic mute LED controls") we allow enabling the mic mute LED with
multiple ADCs.  The commit changed the function return value to be
zero or a negative error, while this change was overlooked in the
thinkpad_acpi helper code where it still expects a positive return
value for success.  This eventually leads to a NULL dereference on a
system that has only a mic mute LED.

This patch corrects the return value check in the corresponding code
as well.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201621
Fixes: c647f80 ("ALSA: hda - Allow multiple ADCs for mic mute LED controls")
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Nov 6, 2018
1 parent fc09ab7 commit 5e93a12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/pci/hda/thinkpad_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec,
removefunc = false;
}
if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0 &&
snd_hda_gen_add_micmute_led(codec,
update_tpacpi_micmute) > 0)
!snd_hda_gen_add_micmute_led(codec,
update_tpacpi_micmute))
removefunc = false;
}

Expand Down

0 comments on commit 5e93a12

Please sign in to comment.