diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 4292cc33c119..2f420c0b6609 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -1121,7 +1121,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { ret = wtp_allocate(hdev, id); if (ret) - return ret; + goto wtp_allocate_fail; } INIT_WORK(&hidpp->work, delayed_work_cb); @@ -1141,6 +1141,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) if (id->group != HID_GROUP_LOGITECH_DJ_DEVICE) { if (!connected) { hid_err(hdev, "Device not connected"); + hid_device_io_stop(hdev); goto hid_parse_fail; } @@ -1186,6 +1187,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) hid_parse_fail: cancel_work_sync(&hidpp->work); mutex_destroy(&hidpp->send_mutex); +wtp_allocate_fail: hid_set_drvdata(hdev, NULL); return ret; }