Address feedback from Shubhrajyoti Datta:
Cast return value
Michael Hennerich:
Use i2c_smbus_read_byte_data()
Fix return value check
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
struct i2c_client *client = st->client;
int ret = 0;
- ret = i2c_smbus_read_word_data(client, reg);
+ ret = i2c_smbus_read_byte_data(client, reg);
if (ret < 0) {
dev_err(&client->dev, "I2C read error\n");
return ret;
}
- *data = ret;
+ *data = (u8)ret;
return 0;
}
mask = 1 << this_attr->address;
/* If ring buffer capture is occuring, query the buffer */
if (iio_ring_enabled(dev_info)) {
- data = ad799x_single_channel_from_ring(st, mask);
- if (data < 0) {
- ret = data;
+ data = ret = ad799x_single_channel_from_ring(st, mask);
+ if (ret < 0)
goto error_ret;
- }
+ ret = 0;
} else {
switch (st->id) {
case ad7991: