Commit 0438ee70 authored by Jiri Kosina's avatar Jiri Kosina

HID: cp2112: fix incorrect error propagation in cp2112_xfer()

Both cp2112_read_req() and cp2112_write_req() are returning negative
value in cases of error, but cp2112_xfer() is storing the return
value into unsigned size_t-typed 'count'.

Fix this by making 'count' signed type.

Reported-by: fengguang.wu@intel.com
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent a47dc4d8
...@@ -428,7 +428,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr, ...@@ -428,7 +428,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
struct hid_device *hdev = dev->hdev; struct hid_device *hdev = dev->hdev;
u8 buf[64]; u8 buf[64];
__be16 word; __be16 word;
size_t count; ssize_t count;
size_t read_length = 0; size_t read_length = 0;
unsigned int retries; unsigned int retries;
int ret; int 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