提交 5bb8e72d 编写于 作者: L Lee Jones 提交者: Jonathan Cameron

iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()

Saving a few lines of code.
Signed-off-by: NLee Jones <lee.jones@linaro.org>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 362f2f86
...@@ -352,28 +352,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev, ...@@ -352,28 +352,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) { if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
err = -EBUSY; err = -EBUSY;
goto read_error; goto out;
} else { } else {
err = st_sensors_set_enable(indio_dev, true); err = st_sensors_set_enable(indio_dev, true);
if (err < 0) if (err < 0)
goto read_error; goto out;
msleep((sdata->sensor->bootime * 1000) / sdata->odr); msleep((sdata->sensor->bootime * 1000) / sdata->odr);
err = st_sensors_read_axis_data(indio_dev, ch, val); err = st_sensors_read_axis_data(indio_dev, ch, val);
if (err < 0) if (err < 0)
goto read_error; goto out;
*val = *val >> ch->scan_type.shift; *val = *val >> ch->scan_type.shift;
err = st_sensors_set_enable(indio_dev, false); err = st_sensors_set_enable(indio_dev, false);
} }
out:
mutex_unlock(&indio_dev->mlock); mutex_unlock(&indio_dev->mlock);
return err; return err;
read_error:
mutex_unlock(&indio_dev->mlock);
return err;
} }
EXPORT_SYMBOL(st_sensors_read_info_raw); EXPORT_SYMBOL(st_sensors_read_info_raw);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册