Commit 69c98879 authored by Miquel Raynal's avatar Miquel Raynal Committed by Jonathan Cameron

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: default avatarJonathan Cameron <jic23@kernel.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-5-miquel.raynal@bootlin.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f8ac59f5
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment