]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
HID: nvidia-shield: Fix a missing led_classdev_unregister() in the probe error handli...
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 18 Sep 2023 11:54:30 +0000 (04:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 20:03:04 +0000 (22:03 +0200)
[ Upstream commit b07b6b27a50e3a740c9aa6260ee4bb3ab29515ab ]

The commit in Fixes updated the error handling path of
thunderstrike_create() and the remove function but not the error handling
path of shield_probe(), should an error occur after a successful
thunderstrike_create() call.

Add the missing call. Make sure it is safe to call in the probe error
handling path by preventing the led_classdev from attempting to set the LED
brightness to the off state on unregister.

Fixes: f88af60e74a5 ("HID: nvidia-shield: Support LED functionality for Thunderstrike")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-nvidia-shield.c

index 9c449741350790b7da5a9b550a3e27945882efd4..1ce9e42f57c71125a3ab47f809d33b3b3d4b17fc 100644 (file)
@@ -482,7 +482,7 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts)
 
        led->name = "thunderstrike:blue:led";
        led->max_brightness = 1;
-       led->flags = LED_CORE_SUSPENDRESUME;
+       led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN;
        led->brightness_get = &thunderstrike_led_get_brightness;
        led->brightness_set = &thunderstrike_led_set_brightness;
 
@@ -694,6 +694,7 @@ err_stop:
 err_haptics:
        if (ts->haptics_dev)
                input_unregister_device(ts->haptics_dev);
+       led_classdev_unregister(&ts->led_dev);
        return ret;
 }