Code Review
/
kvmfornfv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
These changes are a raw update to a vanilla kernel 4.1.10, with the
[kvmfornfv.git]
/
kernel
/
drivers
/
hid
/
hid-cp2112.c
diff --git
a/kernel/drivers/hid/hid-cp2112.c
b/kernel/drivers/hid/hid-cp2112.c
index
3318de6
..
39bf747
100644
(file)
--- a/
kernel/drivers/hid/hid-cp2112.c
+++ b/
kernel/drivers/hid/hid-cp2112.c
@@
-356,6
+356,8
@@
static int cp2112_read(struct cp2112_device *dev, u8 *data, size_t size)
struct cp2112_force_read_report report;
int ret;
struct cp2112_force_read_report report;
int ret;
+ if (size > sizeof(dev->read_data))
+ size = sizeof(dev->read_data);
report.report = CP2112_DATA_READ_FORCE_SEND;
report.length = cpu_to_be16(size);
report.report = CP2112_DATA_READ_FORCE_SEND;
report.length = cpu_to_be16(size);
@@
-535,7
+537,7
@@
static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
struct cp2112_device *dev = (struct cp2112_device *)adap->algo_data;
struct hid_device *hdev = dev->hdev;
u8 buf[64];
struct cp2112_device *dev = (struct cp2112_device *)adap->algo_data;
struct hid_device *hdev = dev->hdev;
u8 buf[64];
- __
b
e16 word;
+ __
l
e16 word;
ssize_t count;
size_t read_length = 0;
unsigned int retries;
ssize_t count;
size_t read_length = 0;
unsigned int retries;
@@
-552,7
+554,7
@@
static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
if (I2C_SMBUS_READ == read_write)
count = cp2112_read_req(buf, addr, read_length);
else
if (I2C_SMBUS_READ == read_write)
count = cp2112_read_req(buf, addr, read_length);
else
- count = cp2112_write_req(buf, addr,
data->byte
, NULL,
+ count = cp2112_write_req(buf, addr,
command
, NULL,
0);
break;
case I2C_SMBUS_BYTE_DATA:
0);
break;
case I2C_SMBUS_BYTE_DATA:
@@
-567,7
+569,7
@@
static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
break;
case I2C_SMBUS_WORD_DATA:
read_length = 2;
break;
case I2C_SMBUS_WORD_DATA:
read_length = 2;
- word = cpu_to_
b
e16(data->word);
+ word = cpu_to_
l
e16(data->word);
if (I2C_SMBUS_READ == read_write)
count = cp2112_write_read_req(buf, addr, read_length,
if (I2C_SMBUS_READ == read_write)
count = cp2112_write_read_req(buf, addr, read_length,
@@
-580,7
+582,7
@@
static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
size = I2C_SMBUS_WORD_DATA;
read_write = I2C_SMBUS_READ;
read_length = 2;
size = I2C_SMBUS_WORD_DATA;
read_write = I2C_SMBUS_READ;
read_length = 2;
- word = cpu_to_
b
e16(data->word);
+ word = cpu_to_
l
e16(data->word);
count = cp2112_write_read_req(buf, addr, read_length, command,
(u8 *)&word, 2);
count = cp2112_write_read_req(buf, addr, read_length, command,
(u8 *)&word, 2);
@@
-673,7
+675,7
@@
static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
data->byte = buf[0];
break;
case I2C_SMBUS_WORD_DATA:
data->byte = buf[0];
break;
case I2C_SMBUS_WORD_DATA:
- data->word =
be16_to_cpup((__b
e16 *)buf);
+ data->word =
le16_to_cpup((__l
e16 *)buf);
break;
case I2C_SMBUS_BLOCK_DATA:
if (read_length > I2C_SMBUS_BLOCK_MAX) {
break;
case I2C_SMBUS_BLOCK_DATA:
if (read_length > I2C_SMBUS_BLOCK_MAX) {