Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: accel: sca3000: replace error_ret labels by simple returns

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>

authored by

Andrew Ijano and committed by
Jonathan Cameron
a80ad80f 6f6bf978

+11 -18
+11 -18
drivers/iio/accel/sca3000.c
··· 369 369 370 370 ret = sca3000_reg_lock_on(st); 371 371 if (ret < 0) 372 - goto error_ret; 372 + return ret; 373 373 if (ret) { 374 374 ret = __sca3000_unlock_reg_lock(st); 375 375 if (ret) 376 - goto error_ret; 376 + return ret; 377 377 } 378 378 379 379 /* Set the control select register */ 380 380 ret = sca3000_write_reg(st, SCA3000_REG_CTRL_SEL_ADDR, sel); 381 381 if (ret) 382 - goto error_ret; 382 + return ret; 383 383 384 384 /* Write the actual value into the register */ 385 - ret = sca3000_write_reg(st, SCA3000_REG_CTRL_DATA_ADDR, val); 386 - 387 - error_ret: 388 - return ret; 385 + return sca3000_write_reg(st, SCA3000_REG_CTRL_DATA_ADDR, val); 389 386 } 390 387 391 388 /** ··· 399 402 400 403 ret = sca3000_reg_lock_on(st); 401 404 if (ret < 0) 402 - goto error_ret; 405 + return ret; 403 406 if (ret) { 404 407 ret = __sca3000_unlock_reg_lock(st); 405 408 if (ret) 406 - goto error_ret; 409 + return ret; 407 410 } 408 411 /* Set the control select register */ 409 412 ret = sca3000_write_reg(st, SCA3000_REG_CTRL_SEL_ADDR, ctrl_reg); 410 413 if (ret) 411 - goto error_ret; 414 + return ret; 412 415 ret = sca3000_read_data_short(st, SCA3000_REG_CTRL_DATA_ADDR, 1); 413 416 if (ret) 414 - goto error_ret; 417 + return ret; 415 418 return st->rx[0]; 416 - error_ret: 417 - return ret; 418 419 } 419 420 420 421 /** ··· 572 577 573 578 ret = sca3000_read_data_short(st, SCA3000_REG_MODE_ADDR, 1); 574 579 if (ret) 575 - goto error_ret; 580 + return ret; 581 + 576 582 switch (SCA3000_REG_MODE_MODE_MASK & st->rx[0]) { 577 583 case SCA3000_REG_MODE_MEAS_MODE_NORMAL: 578 584 *base_freq = info->measurement_mode_freq; ··· 587 591 default: 588 592 ret = -EINVAL; 589 593 } 590 - error_ret: 591 594 return ret; 592 595 } 593 596 ··· 829 834 val = st->rx[0]; 830 835 mutex_unlock(&st->lock); 831 836 if (ret) 832 - goto error_ret; 837 + return ret; 833 838 834 839 switch (val & SCA3000_REG_MODE_MODE_MASK) { 835 840 case SCA3000_REG_MODE_MEAS_MODE_NORMAL: ··· 852 857 break; 853 858 } 854 859 return len; 855 - error_ret: 856 - return ret; 857 860 } 858 861 859 862 /*