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

Configure Feed

Select the types of activity you want to include in your feed.

iio: sca3000: use guard(mutex) to simplify return paths

Switch sca3000_stop_all_interrupts() to use guard(mutex) to simplify the
error paths without needing a goto.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Harshit Mogalapalli and committed by
Jonathan Cameron
31ac6410 8358169e

+5 -4
+5 -4
drivers/iio/accel/sca3000.c
··· 7 7 * See industrialio/accels/sca3000.h for comments. 8 8 */ 9 9 10 + #include <linux/cleanup.h> 10 11 #include <linux/interrupt.h> 11 12 #include <linux/fs.h> 12 13 #include <linux/device.h> ··· 1432 1431 { 1433 1432 int ret; 1434 1433 1435 - mutex_lock(&st->lock); 1434 + guard(mutex)(&st->lock); 1435 + 1436 1436 ret = sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); 1437 1437 if (ret) 1438 - goto error_ret; 1438 + return; 1439 + 1439 1440 sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR, 1440 1441 (st->rx[0] & 1441 1442 ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER | 1442 1443 SCA3000_REG_INT_MASK_RING_HALF | 1443 1444 SCA3000_REG_INT_MASK_ALL_INTS))); 1444 - error_ret: 1445 - mutex_unlock(&st->lock); 1446 1445 } 1447 1446 1448 1447 static int sca3000_probe(struct spi_device *spi)