Skip to content

Commit b07b6b2

Browse files
tititiou36Jiri Kosina
authored and
Jiri Kosina
committed
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: f88af60 ("HID: nvidia-shield: Support LED functionality for Thunderstrike") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Rahul Rameshbabu <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 1437e45 commit b07b6b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/hid/hid-nvidia-shield.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts)
801801
led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,
802802
"thunderstrike%d:blue:led", ts->id);
803803
led->max_brightness = 1;
804-
led->flags = LED_CORE_SUSPENDRESUME;
804+
led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN;
805805
led->brightness_get = &thunderstrike_led_get_brightness;
806806
led->brightness_set = &thunderstrike_led_set_brightness;
807807

@@ -1076,6 +1076,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id)
10761076
err_haptics:
10771077
if (ts->haptics_dev)
10781078
input_unregister_device(ts->haptics_dev);
1079+
led_classdev_unregister(&ts->led_dev);
10791080
return ret;
10801081
}
10811082

0 commit comments

Comments
 (0)