Commit bf159447 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

HID: logitech-hidpp: bail out if wtp_connect fails

If wtp_connect() fails, that means most of the time that the device has
been disconnected. Subsequent attempts to contact the device will fail
too, so it's simpler to bail out earlier.
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: default avatarPeter Wu <peter@lekensteyn.nl>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent e529fea9
...@@ -862,24 +862,24 @@ static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -862,24 +862,24 @@ static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id)
return 0; return 0;
}; };
static void wtp_connect(struct hid_device *hdev, bool connected) static int wtp_connect(struct hid_device *hdev, bool connected)
{ {
struct hidpp_device *hidpp = hid_get_drvdata(hdev); struct hidpp_device *hidpp = hid_get_drvdata(hdev);
struct wtp_data *wd = hidpp->private_data; struct wtp_data *wd = hidpp->private_data;
int ret; int ret;
if (!connected) if (!connected)
return; return 0;
if (!wd->x_size) { if (!wd->x_size) {
ret = wtp_get_config(hidpp); ret = wtp_get_config(hidpp);
if (ret) { if (ret) {
hid_err(hdev, "Can not get wtp config: %d\n", ret); hid_err(hdev, "Can not get wtp config: %d\n", ret);
return; return ret;
} }
} }
hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, return hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index,
true, true); true, true);
} }
...@@ -1063,8 +1063,11 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) ...@@ -1063,8 +1063,11 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
struct input_dev *input; struct input_dev *input;
char *name, *devm_name; char *name, *devm_name;
if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) {
wtp_connect(hdev, connected); ret = wtp_connect(hdev, connected);
if (ret)
return;
}
if (!connected || hidpp->delayed_input) if (!connected || hidpp->delayed_input)
return; return;
......
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