提交 21184c4e 编写于 作者: A Axel Lin 提交者: Dmitry Torokhov

Input: cy8ctmg110_ts - fix checking return value of i2c_master_send

i2c_master_send returns negative errno, or else the number of bytes written.
Signed-off-by: NAxel Lin <axel.lin@gmail.com>
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
上级 fea2021c
...@@ -84,9 +84,9 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg, ...@@ -84,9 +84,9 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg,
memcpy(i2c_data + 1, value, len); memcpy(i2c_data + 1, value, len);
ret = i2c_master_send(client, i2c_data, len + 1); 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"); dev_err(&client->dev, "i2c write data cmd failed\n");
return ret ? ret : -EIO; return ret < 0 ? ret : -EIO;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册