Commit 2089eecd authored by Aditya Pakki's avatar Aditya Pakki Committed by Stefan Bader

HID: lenovo: Add checks to fix of_led_classdev_register

BugLink: https://bugs.launchpad.net/bugs/1818813

[ Upstream commit 6ae16dfb ]

In lenovo_probe_tpkbd(), the function of_led_classdev_register() could
return an error value that is unchecked. The fix adds these checks.
Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 8b3b4be2
......@@ -703,7 +703,9 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev)
data_pointer->led_mute.brightness_get = lenovo_led_brightness_get_tpkbd;
data_pointer->led_mute.brightness_set = lenovo_led_brightness_set_tpkbd;
data_pointer->led_mute.dev = dev;
led_classdev_register(dev, &data_pointer->led_mute);
ret = led_classdev_register(dev, &data_pointer->led_mute);
if (ret < 0)
goto err;
data_pointer->led_micmute.name = name_micmute;
data_pointer->led_micmute.brightness_get =
......@@ -711,7 +713,11 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev)
data_pointer->led_micmute.brightness_set =
lenovo_led_brightness_set_tpkbd;
data_pointer->led_micmute.dev = dev;
led_classdev_register(dev, &data_pointer->led_micmute);
ret = led_classdev_register(dev, &data_pointer->led_micmute);
if (ret < 0) {
led_classdev_unregister(&data_pointer->led_mute);
goto err;
}
lenovo_features_set_tpkbd(hdev);
......
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