diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-02-07 15:38:31 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-04-10 16:15:02 +0100 |
commit | 69c9887997729cc989849e6cba17fb11093ade1d (patch) | |
tree | 924ceaae8e98cffe00a7c8e635e857c44f243b2d /drivers/iio | |
parent | f8ac59f5379f05b2f43b891672a222da72e036f2 (diff) | |
download | linux-69c9887997729cc989849e6cba17fb11093ade1d.tar.gz linux-69c9887997729cc989849e6cba17fb11093ade1d.tar.bz2 linux-69c9887997729cc989849e6cba17fb11093ade1d.zip |
iio: st_sensors: Return as early as possible from the _write_raw() callbacks
As there is no cleanup to do, let's return as early as possible in the
various ST sensor drivers _write_raw() callback functions.
There is no functional change.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-5-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/accel/st_accel_core.c | 5 | ||||
-rw-r--r-- | drivers/iio/gyro/st_gyro_core.c | 7 | ||||
-rw-r--r-- | drivers/iio/magnetometer/st_magn_core.c | 7 |
3 files changed, 5 insertions, 14 deletions
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index 673f3807f001..e029589a668a 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -1217,8 +1217,7 @@ static int st_accel_write_raw(struct iio_dev *indio_dev, int gain; gain = val * 1000000 + val2; - err = st_sensors_set_fullscale_by_gain(indio_dev, gain); - break; + return st_sensors_set_fullscale_by_gain(indio_dev, gain); } case IIO_CHAN_INFO_SAMP_FREQ: if (val2) @@ -1230,8 +1229,6 @@ static int st_accel_write_raw(struct iio_dev *indio_dev, default: return -EINVAL; } - - return err; } static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL(); diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index 62172e18d0d8..9b0cd314496e 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c @@ -410,8 +410,7 @@ static int st_gyro_write_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_SCALE: - err = st_sensors_set_fullscale_by_gain(indio_dev, val2); - break; + return st_sensors_set_fullscale_by_gain(indio_dev, val2); case IIO_CHAN_INFO_SAMP_FREQ: if (val2) return -EINVAL; @@ -420,10 +419,8 @@ static int st_gyro_write_raw(struct iio_dev *indio_dev, mutex_unlock(&indio_dev->mlock); return err; default: - err = -EINVAL; + return -EINVAL; } - - return err; } static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL(); diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 74435f4a427d..78c407c96e17 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c @@ -544,8 +544,7 @@ static int st_magn_write_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_SCALE: - err = st_sensors_set_fullscale_by_gain(indio_dev, val2); - break; + return st_sensors_set_fullscale_by_gain(indio_dev, val2); case IIO_CHAN_INFO_SAMP_FREQ: if (val2) return -EINVAL; @@ -554,10 +553,8 @@ static int st_magn_write_raw(struct iio_dev *indio_dev, mutex_unlock(&indio_dev->mlock); return err; default: - err = -EINVAL; + return -EINVAL; } - - return err; } static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL(); |