linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] input: cy8ctmg100_ts: signedness bug
@ 2010-08-06  6:30 Dan Carpenter
  2010-08-06  6:46 ` Dmitry Torokhov
  2010-08-06 11:20 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-08-06  6:30 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Alan Cox, linux-input, kernel-janitors

"ret" should be signed here or the error handling doesn't work.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 4eb7df0..f4e893f 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -96,7 +96,7 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc,
 		unsigned char *data, unsigned char len, unsigned char cmd)
 {
 	struct i2c_client *client = tsc->client;
-	unsigned int ret;
+	int ret;
 	struct i2c_msg msg[2] = {
 		/* first write slave position to i2c devices */
 		{ client->addr, 0, 1, &cmd },

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] input: cy8ctmg100_ts: signedness bug
  2010-08-06  6:30 [patch] input: cy8ctmg100_ts: signedness bug Dan Carpenter
@ 2010-08-06  6:46 ` Dmitry Torokhov
  2010-08-06  7:40   ` Dan Carpenter
  2010-08-06 11:20 ` Alan Cox
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2010-08-06  6:46 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alan Cox, linux-input, kernel-janitors

On Fri, Aug 06, 2010 at 08:30:06AM +0200, Dan Carpenter wrote:
> "ret" should be signed here or the error handling doesn't work.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
> index 4eb7df0..f4e893f 100644
> --- a/drivers/input/touchscreen/cy8ctmg110_ts.c
> +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
> @@ -96,7 +96,7 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc,
>  		unsigned char *data, unsigned char len, unsigned char cmd)
>  {
>  	struct i2c_client *client = tsc->client;
> -	unsigned int ret;
> +	int ret;
>  	struct i2c_msg msg[2] = {
>  		/* first write slave position to i2c devices */
>  		{ client->addr, 0, 1, &cmd },

Thanks Dan. It looks like cy8ctmg110_write_regs has siilar issue. Do you
thiks the following will work?

Thanks.

-- 
Dmitry

Input: cy8ctmg100_ts - signedness bug

From: Dan Carpenter <error27@gmail.com>

"ret" should be signed here or the error handling doesn't work.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/touchscreen/cy8ctmg110_ts.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 4eb7df0..5ec0946 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -75,7 +75,7 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg,
 		unsigned char len, unsigned char *value)
 {
 	struct i2c_client *client = tsc->client;
-	unsigned int ret;
+	int ret;
 	unsigned char i2c_data[6];
 
 	BUG_ON(len > 5);
@@ -86,7 +86,7 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg,
 	ret = i2c_master_send(client, i2c_data, len + 1);
 	if (ret != 1) {
 		dev_err(&client->dev, "i2c write data cmd failed\n");
-		return ret;
+		return ret ? ret : -EIO;
 	}
 
 	return 0;
@@ -96,7 +96,7 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc,
 		unsigned char *data, unsigned char len, unsigned char cmd)
 {
 	struct i2c_client *client = tsc->client;
-	unsigned int ret;
+	int ret;
 	struct i2c_msg msg[2] = {
 		/* first write slave position to i2c devices */
 		{ client->addr, 0, 1, &cmd },

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] input: cy8ctmg100_ts: signedness bug
  2010-08-06  6:46 ` Dmitry Torokhov
@ 2010-08-06  7:40   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-08-06  7:40 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Alan Cox, linux-input, kernel-janitors

On Thu, Aug 05, 2010 at 11:46:09PM -0700, Dmitry Torokhov wrote:
> 
> Thanks Dan. It looks like cy8ctmg110_write_regs has siilar issue. Do you
> thiks the following will work?
> 
> Thanks.
> 

Ah right.  That should be signed as well.  Thanks.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] input: cy8ctmg100_ts: signedness bug
  2010-08-06  6:30 [patch] input: cy8ctmg100_ts: signedness bug Dan Carpenter
  2010-08-06  6:46 ` Dmitry Torokhov
@ 2010-08-06 11:20 ` Alan Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2010-08-06 11:20 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Dmitry Torokhov, linux-input, kernel-janitors

On Fri, 6 Aug 2010 08:30:06 +0200
Dan Carpenter <error27@gmail.com> wrote:

> "ret" should be signed here or the error handling doesn't work.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Alan Cox <alan@linux.intel.com>

Well spotted

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-06 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06  6:30 [patch] input: cy8ctmg100_ts: signedness bug Dan Carpenter
2010-08-06  6:46 ` Dmitry Torokhov
2010-08-06  7:40   ` Dan Carpenter
2010-08-06 11:20 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).