From: Lee Jones Date: Mon, 16 Sep 2013 16:02:00 +0000 (+0100) Subject: iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor() X-Git-Tag: next-20130927~23^2~139^2~13 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=efd9566ff8aef07d89d9ee530b65b38dad3b8eb9;p=karo-tx-linux.git 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 Signed-off-by: Jonathan Cameron --- 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, 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);