aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/common
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-09-16 12:02:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-09-21 14:24:04 -0400
commitefd9566ff8aef07d89d9ee530b65b38dad3b8eb9 (patch)
treea686651a9b41aa29873d306b82a5fcdc47ecb270 /drivers/iio/common
parent38d1c6a9116bd9642ebcb027ac66305590aa8488 (diff)
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>
Diffstat (limited to 'drivers/iio/common')
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index d21b611d875b..32a56fda51fe 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -241,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
241 241
242 err = st_sensors_set_enable(indio_dev, false); 242 err = st_sensors_set_enable(indio_dev, false);
243 if (err < 0) 243 if (err < 0)
244 goto init_error; 244 return err;
245 245
246 if (sdata->current_fullscale) { 246 if (sdata->current_fullscale) {
247 err = st_sensors_set_fullscale(indio_dev, 247 err = st_sensors_set_fullscale(indio_dev,
248 sdata->current_fullscale->num); 248 sdata->current_fullscale->num);
249 if (err < 0) 249 if (err < 0)
250 goto init_error; 250 return err;
251 } else 251 } else
252 dev_info(&indio_dev->dev, "Full-scale not possible\n"); 252 dev_info(&indio_dev->dev, "Full-scale not possible\n");
253 253
254 err = st_sensors_set_odr(indio_dev, sdata->odr); 254 err = st_sensors_set_odr(indio_dev, sdata->odr);
255 if (err < 0) 255 if (err < 0)
256 goto init_error; 256 return err;
257 257
258 /* set BDU */ 258 /* set BDU */
259 err = st_sensors_write_data_with_mask(indio_dev, 259 err = st_sensors_write_data_with_mask(indio_dev,
260 sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true); 260 sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);
261 if (err < 0) 261 if (err < 0)
262 goto init_error; 262 return err;
263 263
264 err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS); 264 err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
265 265
266init_error:
267 return err; 266 return err;
268} 267}
269EXPORT_SYMBOL(st_sensors_init_sensor); 268EXPORT_SYMBOL(st_sensors_init_sensor);