aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm8350-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/wm8350-i2c.c')
-rw-r--r--drivers/mfd/wm8350-i2c.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
index 8dfe21bb3bd1..3e0ce0e50ea2 100644
--- a/drivers/mfd/wm8350-i2c.c
+++ b/drivers/mfd/wm8350-i2c.c
@@ -30,7 +30,12 @@ static int wm8350_i2c_read_device(struct wm8350 *wm8350, char reg,
30 ret = i2c_master_send(wm8350->i2c_client, &reg, 1); 30 ret = i2c_master_send(wm8350->i2c_client, &reg, 1);
31 if (ret < 0) 31 if (ret < 0)
32 return ret; 32 return ret;
33 return i2c_master_recv(wm8350->i2c_client, dest, bytes); 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;
34} 39}
35 40
36static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg, 41static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
@@ -38,13 +43,19 @@ static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
38{ 43{
39 /* we add 1 byte for device register */ 44 /* we add 1 byte for device register */
40 u8 msg[(WM8350_MAX_REGISTER << 1) + 1]; 45 u8 msg[(WM8350_MAX_REGISTER << 1) + 1];
46 int ret;
41 47
42 if (bytes > ((WM8350_MAX_REGISTER << 1) + 1)) 48 if (bytes > ((WM8350_MAX_REGISTER << 1) + 1))
43 return -EINVAL; 49 return -EINVAL;
44 50
45 msg[0] = reg; 51 msg[0] = reg;
46 memcpy(&msg[1], src, bytes); 52 memcpy(&msg[1], src, bytes);
47 return i2c_master_send(wm8350->i2c_client, msg, bytes + 1); 53 ret = i2c_master_send(wm8350->i2c_client, msg, bytes + 1);
54 if (ret < 0)
55 return ret;
56 if (ret != bytes + 1)
57 return -EIO;
58 return 0;
48} 59}
49 60
50static int wm8350_i2c_probe(struct i2c_client *i2c, 61static int wm8350_i2c_probe(struct i2c_client *i2c,