All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Input: cy8ctmg110_ts - fix checking return value of i2c_master_send
@ 2011-07-12  8:43 Axel Lin
  0 siblings, 0 replies; only message in thread
From: Axel Lin @ 2011-07-12  8:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Dmitry Torokhov, Samuli Konttila, linux-input

i2c_master_send returns negative errno, or else the number of bytes written.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/input/touchscreen/cy8ctmg110_ts.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 4481cc5..d7afa20 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -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;
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-12  8:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-12  8:43 [PATCH v2] Input: cy8ctmg110_ts - fix checking return value of i2c_master_send Axel Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.