Commit cb818a04 authored by Rahul Rameshbabu's avatar Rahul Rameshbabu Committed by Jiri Kosina

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: f88af60e ("HID: nvidia-shield: Support LED functionality for Thunderstrike")
Signed-off-by: default avatarRahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 1d754604
...@@ -513,21 +513,22 @@ static struct shield_device *thunderstrike_create(struct hid_device *hdev) ...@@ -513,21 +513,22 @@ static struct shield_device *thunderstrike_create(struct hid_device *hdev)
hid_set_drvdata(hdev, shield_dev); 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); ret = thunderstrike_led_create(ts);
if (ret) { if (ret) {
hid_err(hdev, "Failed to create Thunderstrike LED instance\n"); 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; goto err;
}
hid_info(hdev, "Registered Thunderstrike controller\n"); hid_info(hdev, "Registered Thunderstrike controller\n");
return shield_dev; return shield_dev;
err: err:
led_classdev_unregister(&ts->led_dev); if (ts->haptics_dev)
input_unregister_device(ts->haptics_dev);
return ERR_CAST(ts->haptics_dev); return ERR_CAST(ts->haptics_dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment