staging:iio:ade7854: Fix the wrong number of bits to read
authorJohn Syne <rodrigosiqueiramelo@gmail.com>
Fri, 23 Mar 2018 14:25:48 +0000 (11:25 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 24 Mar 2018 12:42:26 +0000 (12:42 +0000)
Fixes: correctly handle the data size in the read operation for I2C

The function ade7854_i2c_read_reg_32() have to invoke the
i2c_master_recv() for read 32 bits values, however, the counter is set
to 3 which means 24 bits. This patch fixes the wrong size of 24 bits, to
32 bits.

Signed-off-by: John Syne <john3909@gmail.com>
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Fixes: 8d97a5877 ("staging: iio: meter: new driver for ADE7754 devices")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/meter/ade7854-i2c.c

index 4437f1e..37c9574 100644 (file)
@@ -191,7 +191,7 @@ static int ade7854_i2c_read_reg_32(struct device *dev,
        if (ret < 0)
                goto out;
 
-       ret = i2c_master_recv(st->i2c, st->rx, 3);
+       ret = i2c_master_recv(st->i2c, st->rx, 4);
        if (ret < 0)
                goto out;