[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230918041345.59859-2-rrameshbabu@nvidia.com>
Date: Sun, 17 Sep 2023 21:13:43 -0700
From: Rahul Rameshbabu <rrameshbabu@...dia.com>
To: Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>
Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
kernel-janitors@...r.kernel.org, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
Rahul Rameshbabu <rrameshbabu@...dia.com>
Subject: [PATCH v2 1/3] HID: nvidia-shield: Fix a missing led_classdev_unregister() in the probe error handling path
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
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@...adoo.fr>
Reviewed-by: Rahul Rameshbabu <rrameshbabu@...dia.com>
---
Notes:
Changes:
v1->v2:
- Add the LED_RETAIN_AT_SHUTDOWN flag to prevent
led_classdev_unregister from trying to set the LED to off before a
successful call to hid_hw_start.
drivers/hid/hid-nvidia-shield.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
index 43784bb57d3f..c144641452d3 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 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id)
err_haptics:
if (ts->haptics_dev)
input_unregister_device(ts->haptics_dev);
+ led_classdev_unregister(&ts->led_dev);
return ret;
}
--
2.40.1
Powered by blists - more mailing lists