aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 935f387be95a..2b1799a3b212 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -567,18 +567,17 @@ static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep,
567 int reqtype) 567 int reqtype)
568{ 568{
569 struct i2c_client *client = hid->driver_data; 569 struct i2c_client *client = hid->driver_data;
570 struct i2c_hid *ihid = i2c_get_clientdata(client);
571 char *buf; 570 char *buf;
572 int ret; 571 int ret;
572 int len = i2c_hid_get_report_length(rep) - 2;
573 573
574 buf = kzalloc(ihid->bufsize, GFP_KERNEL); 574 buf = kzalloc(len, GFP_KERNEL);
575 if (!buf) 575 if (!buf)
576 return; 576 return;
577 577
578 switch (reqtype) { 578 switch (reqtype) {
579 case HID_REQ_GET_REPORT: 579 case HID_REQ_GET_REPORT:
580 ret = i2c_hid_get_raw_report(hid, rep->id, buf, ihid->bufsize, 580 ret = i2c_hid_get_raw_report(hid, rep->id, buf, len, rep->type);
581 rep->type);
582 if (ret < 0) 581 if (ret < 0)
583 dev_err(&client->dev, "%s: unable to get report: %d\n", 582 dev_err(&client->dev, "%s: unable to get report: %d\n",
584 __func__, ret); 583 __func__, ret);
@@ -587,7 +586,7 @@ static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep,
587 break; 586 break;
588 case HID_REQ_SET_REPORT: 587 case HID_REQ_SET_REPORT:
589 hid_output_report(rep, buf); 588 hid_output_report(rep, buf);
590 i2c_hid_output_raw_report(hid, buf, ihid->bufsize, rep->type); 589 i2c_hid_output_raw_report(hid, buf, len, rep->type);
591 break; 590 break;
592 } 591 }
593 592