Commit 63b3a7d0 authored by Jiri Kosina's avatar Jiri Kosina

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.
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 41f61ecc
...@@ -136,7 +136,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address, ...@@ -136,7 +136,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address,
input[7] = check_sum; input[7] = check_sum;
ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input, 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) { if (ret < 0) {
dev_err(&hdev->dev, "failed to read command (%d)\n", ret); 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, ...@@ -145,8 +146,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address,
if (read_flag) { if (read_flag) {
ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf, ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf,
sizeof(readbuf), HID_FEATURE_REPORT, sizeof(u8)*U1_FEATURE_REPORT_LEN,
HID_REQ_GET_REPORT); HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
if (ret < 0) { if (ret < 0) {
dev_err(&hdev->dev, "failed read register (%d)\n", ret); 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