[PATCH] i2c: bug fix for busses/i2c-mv64xxx.c
authorJean Delvare <khali@linux-fr.org>
Fri, 2 Sep 2005 19:25:47 +0000 (21:25 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Sep 2005 16:26:53 +0000 (09:26 -0700)
When an i2c transfer is successful, an incorrect value is returned.
This patch fixes that.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/busses/i2c-mv64xxx.c

index eb6cc0869938c75f1e2d53b2a35d179956f3ae66..99abca45fece4d9ea24603529e4ff00a5d9ad271 100644 (file)
@@ -423,13 +423,13 @@ static int
 mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 {
        struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap);
-       int     i, rc = 0;
+       int     i, rc;
 
        for (i=0; i<num; i++)
-               if ((rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[i])) != 0)
-                       break;
+               if ((rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[i])) < 0)
+                       return rc;
 
-       return rc;
+       return num;
 }
 
 static struct i2c_algorithm mv64xxx_i2c_algo = {