Skip to content

Commit

Permalink
Input: cy8ctmg110_ts - fix checking return value of i2c_master_send
Browse files Browse the repository at this point in the history
i2c_master_send returns negative errno, or else the number of bytes written.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Axel Lin authored and Dmitry Torokhov committed Jul 13, 2011
1 parent fea2021 commit 21184c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/touchscreen/cy8ctmg110_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg,
memcpy(i2c_data + 1, value, len);

ret = i2c_master_send(client, i2c_data, len + 1);
if (ret != 1) {
if (ret != len + 1) {
dev_err(&client->dev, "i2c write data cmd failed\n");
return ret ? ret : -EIO;
return ret < 0 ? ret : -EIO;
}

return 0;
Expand Down

0 comments on commit 21184c4

Please sign in to comment.