diff options
author | Rahul Rameshbabu <rrameshbabu@nvidia.com> | 2023-08-07 19:36:18 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2023-08-14 12:41:17 +0300 |
commit | cb818a047f2b95f3d9e08568ff7f8f513832ff2f (patch) | |
tree | 55ae19401260198b8df9c5790b1a95c2ec9df8ac /drivers/hid | |
parent | 1d7546042f8fdc4bc39ab91ec966203e2d64f8bd (diff) | |
download | linux-cb818a047f2b95f3d9e08568ff7f8f513832ff2f.tar.xz |
HID: nvidia-shield: Remove led_classdev_unregister in thunderstrike_create
Avoid calling thunderstrike_led_set_brightness from thunderstrike_create
when led_classdev_unregister is called. led_classdev_unregister was called
from thunderstrike_create in the error path. Calling
thunderstrike_led_set_brightness in this situation is unsafe.
Fixes: f88af60e74a5 ("HID: nvidia-shield: Support LED functionality for Thunderstrike")
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-nvidia-shield.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c index a928ad2be62d..4e183650c447 100644 --- a/drivers/hid/hid-nvidia-shield.c +++ b/drivers/hid/hid-nvidia-shield.c @@ -513,21 +513,22 @@ static struct shield_device *thunderstrike_create(struct hid_device *hdev) hid_set_drvdata(hdev, shield_dev); + ts->haptics_dev = shield_haptics_create(shield_dev, thunderstrike_play_effect); + if (IS_ERR(ts->haptics_dev)) + return ERR_CAST(ts->haptics_dev); + ret = thunderstrike_led_create(ts); if (ret) { hid_err(hdev, "Failed to create Thunderstrike LED instance\n"); - return ERR_PTR(ret); - } - - ts->haptics_dev = shield_haptics_create(shield_dev, thunderstrike_play_effect); - if (IS_ERR(ts->haptics_dev)) goto err; + } hid_info(hdev, "Registered Thunderstrike controller\n"); return shield_dev; err: - led_classdev_unregister(&ts->led_dev); + if (ts->haptics_dev) + input_unregister_device(ts->haptics_dev); return ERR_CAST(ts->haptics_dev); } |