]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: accel: sca3000: replace error_ret labels by simple returns
authorAndrew Ijano <andrew.ijano@gmail.com>
Wed, 11 Jun 2025 19:39:19 +0000 (16:39 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 26 Jun 2025 18:32:54 +0000 (19:32 +0100)
Replace usage of error_ret labels by returning directly when handling
errors. Cases that do a mutex unlock were not changed.

Signed-off-by: Andrew Ijano <andrew.lopes@alumni.usp.br>
Co-developed-by: Gustavo Bastos <gustavobastos@usp.br>
Signed-off-by: Gustavo Bastos <gustavobastos@usp.br>
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611194648.18133-2-andrew.lopes@alumni.usp.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/sca3000.c

index aabe4491efd727613b058b009b45187062b19a32..bfa8a3f5a92f439adaa306d8cfeb67f86946db34 100644 (file)
@@ -369,23 +369,20 @@ static int sca3000_write_ctrl_reg(struct sca3000_state *st,
 
        ret = sca3000_reg_lock_on(st);
        if (ret < 0)
-               goto error_ret;
+               return ret;
        if (ret) {
                ret = __sca3000_unlock_reg_lock(st);
                if (ret)
-                       goto error_ret;
+                       return ret;
        }
 
        /* Set the control select register */
        ret = sca3000_write_reg(st, SCA3000_REG_CTRL_SEL_ADDR, sel);
        if (ret)
-               goto error_ret;
+               return ret;
 
        /* Write the actual value into the register */
-       ret = sca3000_write_reg(st, SCA3000_REG_CTRL_DATA_ADDR, val);
-
-error_ret:
-       return ret;
+       return sca3000_write_reg(st, SCA3000_REG_CTRL_DATA_ADDR, val);
 }
 
 /**
@@ -402,22 +399,20 @@ static int sca3000_read_ctrl_reg(struct sca3000_state *st,
 
        ret = sca3000_reg_lock_on(st);
        if (ret < 0)
-               goto error_ret;
+               return ret;
        if (ret) {
                ret = __sca3000_unlock_reg_lock(st);
                if (ret)
-                       goto error_ret;
+                       return ret;
        }
        /* Set the control select register */
        ret = sca3000_write_reg(st, SCA3000_REG_CTRL_SEL_ADDR, ctrl_reg);
        if (ret)
-               goto error_ret;
+               return ret;
        ret = sca3000_read_data_short(st, SCA3000_REG_CTRL_DATA_ADDR, 1);
        if (ret)
-               goto error_ret;
+               return ret;
        return st->rx[0];
-error_ret:
-       return ret;
 }
 
 /**
@@ -577,7 +572,8 @@ static inline int __sca3000_get_base_freq(struct sca3000_state *st,
 
        ret = sca3000_read_data_short(st, SCA3000_REG_MODE_ADDR, 1);
        if (ret)
-               goto error_ret;
+               return ret;
+
        switch (SCA3000_REG_MODE_MODE_MASK & st->rx[0]) {
        case SCA3000_REG_MODE_MEAS_MODE_NORMAL:
                *base_freq = info->measurement_mode_freq;
@@ -591,7 +587,6 @@ static inline int __sca3000_get_base_freq(struct sca3000_state *st,
        default:
                ret = -EINVAL;
        }
-error_ret:
        return ret;
 }
 
@@ -834,7 +829,7 @@ static ssize_t sca3000_read_av_freq(struct device *dev,
        val = st->rx[0];
        mutex_unlock(&st->lock);
        if (ret)
-               goto error_ret;
+               return ret;
 
        switch (val & SCA3000_REG_MODE_MODE_MASK) {
        case SCA3000_REG_MODE_MEAS_MODE_NORMAL:
@@ -857,8 +852,6 @@ static ssize_t sca3000_read_av_freq(struct device *dev,
                break;
        }
        return len;
-error_ret:
-       return ret;
 }
 
 /*