Skip to content

Commit

Permalink
HID: cp2112: fix incorrect error propagation in cp2112_xfer()
Browse files Browse the repository at this point in the history
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: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Feb 18, 2014
1 parent a47dc4d commit 0438ee7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-cp2112.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
struct hid_device *hdev = dev->hdev;
u8 buf[64];
__be16 word;
size_t count;
ssize_t count;
size_t read_length = 0;
unsigned int retries;
int ret;
Expand Down

0 comments on commit 0438ee7

Please sign in to comment.