iio: cros_ec_sensors: Fix return value to get raw and calibbias data.
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>
Fri, 24 Mar 2017 17:44:02 +0000 (18:44 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 25 Mar 2017 15:06:14 +0000 (15:06 +0000)
The cros_ec_sensors_read function must return the type of value on all
cases. This was always true except for RAW and CALIBBIAS data which
returned an error or 0. This patch just fixes the mistake I introduced
when submitting the series.

Fixes: commit c14dca07a31d (iio: cros_ec_sensors: add ChromeOS EC
Contiguous Sensors driver)

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c

index d6c372bb433b4983bca0d99b448ccd5af4e3cdab..c17596f7ed2c30786f6765c091de121870be47d1 100644 (file)
@@ -61,7 +61,7 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev,
                ret = st->core.read_ec_sensors_data(indio_dev, 1 << idx, &data);
                if (ret < 0)
                        break;
-
+               ret = IIO_VAL_INT;
                *val = data;
                break;
        case IIO_CHAN_INFO_CALIBBIAS:
@@ -76,7 +76,7 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev,
                for (i = CROS_EC_SENSOR_X; i < CROS_EC_SENSOR_MAX_AXIS; i++)
                        st->core.calib[i] =
                                st->core.resp->sensor_offset.offset[i];
-
+               ret = IIO_VAL_INT;
                *val = st->core.calib[idx];
                break;
        case IIO_CHAN_INFO_SCALE: