diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2023-09-18 04:54:30 -0700 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2023-10-05 12:50:34 +0200 |
commit | b07b6b27a50e3a740c9aa6260ee4bb3ab29515ab (patch) | |
tree | b30dbc317ece333430c11aed0d28f9487f0d71f5 | |
parent | 1437e4547edf41689d7135faaca4222ef0081bc1 (diff) | |
download | linux-b07b6b27a50e3a740c9aa6260ee4bb3ab29515ab.tar.gz |
HID: nvidia-shield: Fix a missing led_classdev_unregister() in the probe error handling path
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>
-rw-r--r-- | drivers/hid/hid-nvidia-shield.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c index 9a3576dbf42174..c65a88dc3751a1 100644 --- a/drivers/hid/hid-nvidia-shield.c +++ b/drivers/hid/hid-nvidia-shield.c @@ -801,7 +801,7 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts) led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL, "thunderstrike%d:blue:led", ts->id); 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; @@ -1076,6 +1076,7 @@ err_stop: err_haptics: if (ts->haptics_dev) input_unregister_device(ts->haptics_dev); + led_classdev_unregister(&ts->led_dev); return ret; } |