mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
Strip out all those unnecessary gotos and just return the error right away. Aids to simplicity and reduces code. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
38d1c6a911
commit
efd9566ff8
@ -241,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
|
||||
|
||||
err = st_sensors_set_enable(indio_dev, false);
|
||||
if (err < 0)
|
||||
goto init_error;
|
||||
return err;
|
||||
|
||||
if (sdata->current_fullscale) {
|
||||
err = st_sensors_set_fullscale(indio_dev,
|
||||
sdata->current_fullscale->num);
|
||||
if (err < 0)
|
||||
goto init_error;
|
||||
return err;
|
||||
} else
|
||||
dev_info(&indio_dev->dev, "Full-scale not possible\n");
|
||||
|
||||
err = st_sensors_set_odr(indio_dev, sdata->odr);
|
||||
if (err < 0)
|
||||
goto init_error;
|
||||
return err;
|
||||
|
||||
/* set BDU */
|
||||
err = st_sensors_write_data_with_mask(indio_dev,
|
||||
sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);
|
||||
if (err < 0)
|
||||
goto init_error;
|
||||
return err;
|
||||
|
||||
err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
|
||||
|
||||
init_error:
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(st_sensors_init_sensor);
|
||||
|
Loading…
Reference in New Issue
Block a user