platform/x86: ideapad-laptop: Set max_brightness before using it
authorStuart Hayhurst <stuart.a.hayhurst@gmail.com>
Tue, 14 Nov 2023 11:38:08 +0000 (11:38 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Dec 2023 06:33:08 +0000 (07:33 +0100)
commit77cc23ef4306356e96a21f52edc254d9eb7a2c44
tree8cd3b2a89a471789125ff4eb9ab87079fcfb7a86
parent1cceb4820f0523888082173b0ff60e16127b5d73
platform/x86: ideapad-laptop: Set max_brightness before using it

commit 7a3c36eef9a5d13b16aa954da54224c9c6bed339 upstream.

max_brightness is used in ideapad_kbd_bl_brightness_get() before it's set,
causing ideapad_kbd_bl_brightness_get() to return -EINVAL sometimes.

Fixes: ecaa1867b524 ("platform/x86: ideapad-laptop: Add support for keyboard backlights using KBLC ACPI symbol")
Signed-off-by: Stuart Hayhurst <stuart.a.hayhurst@gmail.com>
Cc: stable@vger.kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20231114114055.6220-2-stuart.a.hayhurst@gmail.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/platform/x86/ideapad-laptop.c