mfd: Correct WM8350 I2C return code usage

The vendor BSP used for the WM8350 development provided an I2C driver
which incorrectly returned zero on succesful sends rather than the
number of transmitted bytes, an error which was then propagated into the
WM8350 I2C accessors.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>

authored by Mark Brown and committed by Samuel Ortiz 898d8054 b1ccbdc4

+13 -2
+13 -2
drivers/mfd/wm8350-i2c.c
··· 30 ret = i2c_master_send(wm8350->i2c_client, &reg, 1); 31 if (ret < 0) 32 return ret; 33 - return i2c_master_recv(wm8350->i2c_client, dest, bytes); 34 } 35 36 static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg, ··· 43 { 44 /* we add 1 byte for device register */ 45 u8 msg[(WM8350_MAX_REGISTER << 1) + 1]; 46 47 if (bytes > ((WM8350_MAX_REGISTER << 1) + 1)) 48 return -EINVAL; 49 50 msg[0] = reg; 51 memcpy(&msg[1], src, bytes); 52 - return i2c_master_send(wm8350->i2c_client, msg, bytes + 1); 53 } 54 55 static int wm8350_i2c_probe(struct i2c_client *i2c,
··· 30 ret = i2c_master_send(wm8350->i2c_client, &reg, 1); 31 if (ret < 0) 32 return ret; 33 + ret = i2c_master_recv(wm8350->i2c_client, dest, bytes); 34 + if (ret < 0) 35 + return ret; 36 + if (ret != bytes) 37 + return -EIO; 38 + return 0; 39 } 40 41 static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg, ··· 38 { 39 /* we add 1 byte for device register */ 40 u8 msg[(WM8350_MAX_REGISTER << 1) + 1]; 41 + int ret; 42 43 if (bytes > ((WM8350_MAX_REGISTER << 1) + 1)) 44 return -EINVAL; 45 46 msg[0] = reg; 47 memcpy(&msg[1], src, bytes); 48 + ret = i2c_master_send(wm8350->i2c_client, msg, bytes + 1); 49 + if (ret < 0) 50 + return ret; 51 + if (ret != bytes + 1) 52 + return -EIO; 53 + return 0; 54 } 55 56 static int wm8350_i2c_probe(struct i2c_client *i2c,