summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2023-11-01 02:16:20 +0300
committerJiri Kosina <jkosina@suse.cz>2023-11-01 02:16:20 +0300
commiteacaa65efaa70b292c174629a672916c60981059 (patch)
treed07f75a525ad0ce6abbdac70d6b8de319d434217 /drivers/hid
parent93cfa25b1795ec5f47fdba2241acc2d4957be597 (diff)
parent81701f7132f8cc589a67b6f4ecac2f759f140498 (diff)
downloadlinux-eacaa65efaa70b292c174629a672916c60981059.tar.xz
Merge branch 'for-6.7/nvidia-shield' into for-linus
- probe error handling path fixes in hid-nvidia-shield driver (Christophe JAILLET)
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-nvidia-shield.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
index c463e54decbc..82d0a77359c4 100644
--- a/drivers/hid/hid-nvidia-shield.c
+++ b/drivers/hid/hid-nvidia-shield.c
@@ -915,6 +915,15 @@ err_id:
return ERR_PTR(ret);
}
+static void thunderstrike_destroy(struct thunderstrike *ts)
+{
+ led_classdev_unregister(&ts->led_dev);
+ power_supply_unregister(ts->base.battery_dev.psy);
+ if (ts->haptics_dev)
+ input_unregister_device(ts->haptics_dev);
+ ida_free(&thunderstrike_ida, ts->id);
+}
+
static int android_input_mapping(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field,
struct hid_usage *usage, unsigned long **bit,
@@ -1074,11 +1083,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id)
err_stop:
hid_hw_stop(hdev);
err_ts_create:
- power_supply_unregister(ts->base.battery_dev.psy);
- if (ts->haptics_dev)
- input_unregister_device(ts->haptics_dev);
- led_classdev_unregister(&ts->led_dev);
- ida_free(&thunderstrike_ida, ts->id);
+ thunderstrike_destroy(ts);
return ret;
}
@@ -1090,11 +1095,7 @@ static void shield_remove(struct hid_device *hdev)
ts = container_of(dev, struct thunderstrike, base);
hid_hw_close(hdev);
- power_supply_unregister(dev->battery_dev.psy);
- if (ts->haptics_dev)
- input_unregister_device(ts->haptics_dev);
- led_classdev_unregister(&ts->led_dev);
- ida_free(&thunderstrike_ida, ts->id);
+ thunderstrike_destroy(ts);
del_timer_sync(&ts->psy_stats_timer);
cancel_work_sync(&ts->hostcmd_req_work);
hid_hw_stop(hdev);