Commit 4a818643 authored by Guido Günther's avatar Guido Günther Committed by Jonathan Cameron

iio: vcnl4000: Use a single return when getting IIO_CHAN_INFO_RAW

This will be useful when introducing runtime pm.
Signed-off-by: default avatarGuido Günther <agx@sigxcpu.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 55f82c00
...@@ -335,17 +335,18 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev, ...@@ -335,17 +335,18 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
switch (chan->type) { switch (chan->type) {
case IIO_LIGHT: case IIO_LIGHT:
ret = data->chip_spec->measure_light(data, val); ret = data->chip_spec->measure_light(data, val);
if (ret < 0) if (!ret)
return ret; ret = IIO_VAL_INT;
return IIO_VAL_INT; break;
case IIO_PROXIMITY: case IIO_PROXIMITY:
ret = data->chip_spec->measure_proximity(data, val); ret = data->chip_spec->measure_proximity(data, val);
if (ret < 0) if (!ret)
return ret; ret = IIO_VAL_INT;
return IIO_VAL_INT; break;
default: default:
return -EINVAL; ret = -EINVAL;
} }
return ret;
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
if (chan->type != IIO_LIGHT) if (chan->type != IIO_LIGHT)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment