diff options
author | Mark Brown <broonie@linaro.org> | 2013-10-04 00:30:17 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-04 00:30:17 +0100 |
commit | 18d8ff256f495bee7bcf016d9006d4b330e29260 (patch) | |
tree | e3d01967862b312711e27bd790c57e20c723d0c1 /drivers/hid/hid-lenovo-tpkbd.c | |
parent | 2a0458773656240cf6fa97f1126c92dcddf8ab90 (diff) | |
parent | 8c15abc94c737f9120d3d4a550abbcbb9be121f6 (diff) |
Merge tag 'v3.10.14' into linux-linaro-lsk
This is the 3.10.14 stable release
Diffstat (limited to 'drivers/hid/hid-lenovo-tpkbd.c')
-rw-r--r-- | drivers/hid/hid-lenovo-tpkbd.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c index 07837f5a4eb..31cf29a6ba1 100644 --- a/drivers/hid/hid-lenovo-tpkbd.c +++ b/drivers/hid/hid-lenovo-tpkbd.c @@ -339,7 +339,15 @@ static int tpkbd_probe_tp(struct hid_device *hdev) struct tpkbd_data_pointer *data_pointer; size_t name_sz = strlen(dev_name(dev)) + 16; char *name_mute, *name_micmute; - int ret; + int i, ret; + + /* Validate required reports. */ + for (i = 0; i < 4; i++) { + if (!hid_validate_values(hdev, HID_FEATURE_REPORT, 4, i, 1)) + return -ENODEV; + } + if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 3, 0, 2)) + return -ENODEV; if (sysfs_create_group(&hdev->dev.kobj, &tpkbd_attr_group_pointer)) { @@ -406,22 +414,27 @@ static int tpkbd_probe(struct hid_device *hdev, ret = hid_parse(hdev); if (ret) { hid_err(hdev, "hid_parse failed\n"); - goto err_free; + goto err; } ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) { hid_err(hdev, "hid_hw_start failed\n"); - goto err_free; + goto err; } uhdev = (struct usbhid_device *) hdev->driver_data; - if (uhdev->ifnum == 1) - return tpkbd_probe_tp(hdev); + if (uhdev->ifnum == 1) { + ret = tpkbd_probe_tp(hdev); + if (ret) + goto err_hid; + } return 0; -err_free: +err_hid: + hid_hw_stop(hdev); +err: return ret; } |