Re: [PATCH] iio: adc: ad7280a: replace mutex_lock() with guard(mutex)
From: kernel test robot
Date: Fri Mar 20 2026 - 16:22:36 EST
Hi Matheus,
kernel test robot noticed the following build errors:
[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v7.0-rc4 next-20260320]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matheus-Giarola/iio-adc-ad7280a-replace-mutex_lock-with-guard-mutex/20260320-142509
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link: https://lore.kernel.org/r/20260319184615.10970-1-matheusgiarola%40usp.br
patch subject: [PATCH] iio: adc: ad7280a: replace mutex_lock() with guard(mutex)
config: arm-randconfig-004-20260321 (https://download.01.org/0day-ci/archive/20260321/202603210411.t4KwH3aX-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 4abb927bacf37f18f6359a41639a6d1b3bffffb5)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260321/202603210411.t4KwH3aX-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603210411.t4KwH3aX-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
>> drivers/iio/adc/ad7280a.c:899:2: error: cannot jump from switch statement to this case label
899 | case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
| ^
drivers/iio/adc/ad7280a.c:878:3: note: jump bypasses initialization of variable with __attribute__((cleanup))
878 | guard(mutex)(&st->lock);
| ^
include/linux/cleanup.h:419:2: note: expanded from macro 'guard'
419 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/cleanup.h:300:3: note: expanded from macro 'CLASS'
300 | class_##_name##_constructor
| ^
<scratch space>:15:1: note: expanded from here
15 | class_mutex_constructor
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:21:1: note: expanded from here
21 | __UNIQUE_ID_unlock_538
| ^
drivers/iio/adc/ad7280a.c:878:3: note: jump bypasses initialization of variable with __attribute__((cleanup))
include/linux/cleanup.h:419:15: note: expanded from macro 'guard'
419 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/compiler.h:168:2: note: expanded from macro '__UNIQUE_ID'
168 | __PASTE(__UNIQUE_ID_, \
| ^
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:9:1: note: expanded from here
9 | __UNIQUE_ID_guard_537
| ^
drivers/iio/adc/ad7280a.c:891:2: error: cannot jump from switch statement to this case label
891 | case IIO_CHAN_INFO_SCALE:
| ^
drivers/iio/adc/ad7280a.c:878:3: note: jump bypasses initialization of variable with __attribute__((cleanup))
878 | guard(mutex)(&st->lock);
| ^
include/linux/cleanup.h:419:2: note: expanded from macro 'guard'
419 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/cleanup.h:300:3: note: expanded from macro 'CLASS'
300 | class_##_name##_constructor
| ^
<scratch space>:15:1: note: expanded from here
15 | class_mutex_constructor
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:21:1: note: expanded from here
21 | __UNIQUE_ID_unlock_538
| ^
drivers/iio/adc/ad7280a.c:878:3: note: jump bypasses initialization of variable with __attribute__((cleanup))
include/linux/cleanup.h:419:15: note: expanded from macro 'guard'
419 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/compiler.h:168:2: note: expanded from macro '__UNIQUE_ID'
168 | __PASTE(__UNIQUE_ID_, \
| ^
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:9:1: note: expanded from here
9 | __UNIQUE_ID_guard_537
| ^
2 errors generated.
vim +899 drivers/iio/adc/ad7280a.c
c5fe2f537b91e17 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2022-02-06 866
84f79ecb0c1f393 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2011-10-06 867 static int ad7280_read_raw(struct iio_dev *indio_dev,
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 868 struct iio_chan_spec const *chan,
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 869 int *val,
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 870 int *val2,
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 871 long m)
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 872 {
84f79ecb0c1f393 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2011-10-06 873 struct ad7280_state *st = iio_priv(indio_dev);
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 874 int ret;
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 875
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 876 switch (m) {
b11f98ff8c35d62 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2012-04-15 877 case IIO_CHAN_INFO_RAW:
801020aafb667e4 drivers/iio/adc/ad7280a.c Matheus Giarola 2026-03-19 878 guard(mutex)(&st->lock);
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 879 if (chan->address == AD7280A_ALL_CELLS)
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 880 ret = ad7280_read_all_channels(st, st->scan_cnt, NULL);
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 881 else
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 882 ret = ad7280_read_channel(st, chan->address >> 8,
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 883 chan->address & 0xFF);
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 884
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 885 if (ret < 0)
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 886 return ret;
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 887
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 888 *val = ret;
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 889
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 890 return IIO_VAL_INT;
c8a9f8056f40f62 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2011-10-26 891 case IIO_CHAN_INFO_SCALE:
4c59aabd9a93d8f drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2022-02-06 892 if ((chan->address & 0xFF) <= AD7280A_CELL_VOLTAGE_6_REG)
d6570b33a1c0620 drivers/staging/iio/adc/ad7280a.c Lars-Peter Clausen 2013-09-28 893 *val = 4000;
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 894 else
d6570b33a1c0620 drivers/staging/iio/adc/ad7280a.c Lars-Peter Clausen 2013-09-28 895 *val = 5000;
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 896
d6570b33a1c0620 drivers/staging/iio/adc/ad7280a.c Lars-Peter Clausen 2013-09-28 897 *val2 = AD7280A_BITS;
d6570b33a1c0620 drivers/staging/iio/adc/ad7280a.c Lars-Peter Clausen 2013-09-28 898 return IIO_VAL_FRACTIONAL_LOG2;
c5fe2f537b91e17 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2022-02-06 @899 case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
c5fe2f537b91e17 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2022-02-06 900 *val = ad7280a_n_avg[st->oversampling_ratio];
c5fe2f537b91e17 drivers/staging/iio/adc/ad7280a.c Jonathan Cameron 2022-02-06 901 return IIO_VAL_INT;
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 902 }
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 903 return -EINVAL;
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 904 }
2051f25d2a26573 drivers/staging/iio/adc/ad7280a.c Michael Hennerich 2011-07-20 905
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki