Commit e53cc197 authored by Jiri Kosina's avatar Jiri Kosina Committed by Tim Gardner

HID: alps: pass correct sizes to hid_hw_raw_request()

Calculating size of the report as sizeof(pointer) always passess the length
corresponding to the pointer type, not the underlying data report.

BugLink: https://bugs.launchpad.net/bugs/1616813Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
(cherry picked from commit 63b3a7d0)
Signed-off-by: default avatarYing-Chun Liu (PaulLiu) <paul.liu@canonical.com>
Acked-by: default avatarBrad Figg <brad.figg@canonical.com>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 19a05037
......@@ -136,7 +136,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address,
input[7] = check_sum;
ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
sizeof(u8)*U1_FEATURE_REPORT_LEN, HID_FEATURE_REPORT,
HID_REQ_SET_REPORT);
if (ret < 0) {
dev_err(&hdev->dev, "failed to read command (%d)\n", ret);
......@@ -145,8 +146,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address,
if (read_flag) {
ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf,
sizeof(readbuf), HID_FEATURE_REPORT,
HID_REQ_GET_REPORT);
sizeof(u8)*U1_FEATURE_REPORT_LEN,
HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
if (ret < 0) {
dev_err(&hdev->dev, "failed read register (%d)\n", ret);
......
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