mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
hid: rkvr: fix application of sizeof to pointer
Change-Id: I698445dd006551090578fc04226d5c792094ad05 Signed-off-by: lanshh <lsh@rock-chips.com>
This commit is contained in:
@@ -850,15 +850,15 @@ static int rkvr_hid_read(struct rkvr_iio_hw_device *hdev, int reg, unsigned char
|
||||
struct hid_device *hid = container_of(hdev->dev, struct hid_device, dev);
|
||||
unsigned char report_number = reg;
|
||||
unsigned char report_type = HID_REGR_REPORT;
|
||||
char buf[1 + sizeof(data) * len];
|
||||
int readlen = 1 + sizeof(data) * len;
|
||||
char buf[1 + sizeof(*data) * len];
|
||||
int readlen = 1 + sizeof(*data) * len;
|
||||
int ret;
|
||||
|
||||
ret = hid_hw_raw_request(hid, report_number, (unsigned char *)buf, readlen, report_type, HID_REQ_GET_REPORT);
|
||||
if (ret != readlen) {
|
||||
hid_err(hid, "id_hw_raw_request fail\n");
|
||||
} else {
|
||||
memcpy(data, &buf[1], sizeof(data) * len);
|
||||
memcpy(data, &buf[1], sizeof(*data) * len);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user