Re: [PATCH] iio: imu: kmx61: Use guard(mutex)() family over manual locking

kernel test robot
2026-05-05T08:24:50Z

Hi Maxwell,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v7.1-rc2 next-20260504]
[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/Maxwell-Doose/iio-imu-kmx61-Use-guard-mutex-family-over-manual-locking/20260504-212159
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link: https://lore.kernel.org/r/20260502032455.76107-1-m32285159%40gmail.com
patch subject: [PATCH] iio: imu: kmx61: Use guard(mutex)() family over manual locking
config: i386-buildonly-randconfig-006-20260504 (https://download.01.org/0day-ci/archive/20260505/202605051637.8LggoiJY-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260505/202605051637.8LggoiJY-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605051637.8LggoiJY-lkp@intel.com/

All warnings (new ones prefixed by >>):

drivers/iio/imu/kmx61.c: In function 'kmx61_write_raw':
>> drivers/iio/imu/kmx61.c:847:13: warning: unused variable 'ret' [-Wunused-variable]
847 | int ret;
| ^~~

vim +/ret +847 drivers/iio/imu/kmx61.c

20ffac278ebd64 Daniel Baluta 2014-12-03 842
20ffac278ebd64 Daniel Baluta 2014-12-03 843 static int kmx61_write_raw(struct iio_dev *indio_dev,
20ffac278ebd64 Daniel Baluta 2014-12-03 844 struct iio_chan_spec const *chan, int val,
20ffac278ebd64 Daniel Baluta 2014-12-03 845 int val2, long mask)
20ffac278ebd64 Daniel Baluta 2014-12-03 846 {
20ffac278ebd64 Daniel Baluta 2014-12-03 @847 int ret;
20ffac278ebd64 Daniel Baluta 2014-12-03 848 struct kmx61_data *data = kmx61_get_data(indio_dev);
20ffac278ebd64 Daniel Baluta 2014-12-03 849
20ffac278ebd64 Daniel Baluta 2014-12-03 850 switch (mask) {
20ffac278ebd64 Daniel Baluta 2014-12-03 851 case IIO_CHAN_INFO_SAMP_FREQ:
20ffac278ebd64 Daniel Baluta 2014-12-03 852 if (chan->type != IIO_ACCEL && chan->type != IIO_MAGN)
20ffac278ebd64 Daniel Baluta 2014-12-03 853 return -EINVAL;
20ffac278ebd64 Daniel Baluta 2014-12-03 854
84cb5906c7fb44 Maxwell Doose 2026-05-01 855 guard(mutex)(&data->lock);
84cb5906c7fb44 Maxwell Doose 2026-05-01 856 return kmx61_set_odr(data, val, val2, chan->address);
20ffac278ebd64 Daniel Baluta 2014-12-03 857 case IIO_CHAN_INFO_SCALE:
20ffac278ebd64 Daniel Baluta 2014-12-03 858 switch (chan->type) {
20ffac278ebd64 Daniel Baluta 2014-12-03 859 case IIO_ACCEL:
20ffac278ebd64 Daniel Baluta 2014-12-03 860 if (val != 0)
20ffac278ebd64 Daniel Baluta 2014-12-03 861 return -EINVAL;
84cb5906c7fb44 Maxwell Doose 2026-05-01 862 guard(mutex)(&data->lock);
84cb5906c7fb44 Maxwell Doose 2026-05-01 863 return kmx61_set_scale(data, val2);
20ffac278ebd64 Daniel Baluta 2014-12-03 864 default:
20ffac278ebd64 Daniel Baluta 2014-12-03 865 return -EINVAL;
20ffac278ebd64 Daniel Baluta 2014-12-03 866 }
20ffac278ebd64 Daniel Baluta 2014-12-03 867 default:
20ffac278ebd64 Daniel Baluta 2014-12-03 868 return -EINVAL;
20ffac278ebd64 Daniel Baluta 2014-12-03 869 }
20ffac278ebd64 Daniel Baluta 2014-12-03 870 }
20ffac278ebd64 Daniel Baluta 2014-12-03 871

--
0-DAY CI Kernel Test Service