[PATCH v2 11/11] HID: hid-lenovo-go-s: Stop and close device on probe failure
From: Derek J. Clark
Date: Fri Oct 16 2026 - 21:46:03 EST
If hid_gos_cfg_probe() fails, the HID device has already been started
and opened. Probe failure does not trigger the driver's remove
function, so the device is left open and running.
Close and stop the device on this error path.
Fixes: a23f3497bf208c59ad ("HID: hid-lenovo-go-s: Add Lenovo Legion Go S Series HID Driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Derek J. Clark <derekjohn.clark@xxxxxxxxx>
---
drivers/hid/hid-lenovo-go-s.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-lenovo-go-s.c b/drivers/hid/hid-lenovo-go-s.c
index 1a2b28e1bed1..694b329f30db 100644
--- a/drivers/hid/hid-lenovo-go-s.c
+++ b/drivers/hid/hid-lenovo-go-s.c
@@ -1786,8 +1786,11 @@ static int hid_gos_probe(struct hid_device *hdev,
}
ret = hid_gos_cfg_probe(hdev, id);
- if (ret)
+ if (ret) {
dev_err_probe(&hdev->dev, ret, "Failed to start configuration interface");
+ hid_hw_close(hdev);
+ hid_hw_stop(hdev);
+ }
dev_dbg(&hdev->dev, "Started interface %x as Go S configuration interface\n", ep);
return ret;
--
2.55.0