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/gyro | |
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/gyro')
-rw-r--r-- | drivers/iio/gyro/st_gyro_core.c | 7 |
1 files changed, 2 insertions, 5 deletions
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(); |