Skip to contentSkip to conversation

drivers/iio/accel/adxl372.c:350 adxl372_write_threshold_value() warn: inconsistent returns 'st->threshold_m'.

PATCH New Dan Carpenter 1 participant 1 message Aug 31, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 75/76 drivers/iio/accel/adxl372.c:350 adxl372_write_threshold_value() warn: inconsistent returns 'st->threshold_m'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   b7959420e446032114da12b9af2a36ab62396dce
commit: 84847a0a0c6314106e93d75ee9f50401fd0806ec [75/76] iio: accel: adxl372: Add support for FIFO peak mode
config: microblaze-randconfig-m031-20200830 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate

smatch warnings:
drivers/iio/accel/adxl372.c:350 adxl372_write_threshold_value() warn: inconsistent returns 'st->threshold_m'.

# https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=84847a0a0c6314106e93d75ee9f50401fd0806ec
git remote add iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git fetch --no-tags iio testing
git checkout 84847a0a0c6314106e93d75ee9f50401fd0806ec
vim +350 drivers/iio/accel/adxl372.c

84847a0a0c6314 Stefan Popa 2020-08-10  334  static ssize_t adxl372_write_threshold_value(struct iio_dev *indio_dev, unsigned int addr,
84847a0a0c6314 Stefan Popa 2020-08-10  335  					     u16 threshold)
84847a0a0c6314 Stefan Popa 2020-08-10  336  {
84847a0a0c6314 Stefan Popa 2020-08-10  337  	struct adxl372_state *st = iio_priv(indio_dev);
84847a0a0c6314 Stefan Popa 2020-08-10  338  	int ret;
84847a0a0c6314 Stefan Popa 2020-08-10  339  
84847a0a0c6314 Stefan Popa 2020-08-10  340  	mutex_lock(&st->threshold_m);
84847a0a0c6314 Stefan Popa 2020-08-10  341  	ret = regmap_write(st->regmap, addr, ADXL372_THRESH_VAL_H_SEL(threshold));
84847a0a0c6314 Stefan Popa 2020-08-10  342  	if (ret < 0)
84847a0a0c6314 Stefan Popa 2020-08-10  343  		return ret;
                                                        ^^^^^^^^^^

Goto unlock before returning

84847a0a0c6314 Stefan Popa 2020-08-10  344  
84847a0a0c6314 Stefan Popa 2020-08-10  345  	ret = regmap_update_bits(st->regmap, addr + 1, GENMASK(7, 5),
84847a0a0c6314 Stefan Popa 2020-08-10  346  				 ADXL372_THRESH_VAL_L_SEL(threshold) << 5);
84847a0a0c6314 Stefan Popa 2020-08-10  347  
84847a0a0c6314 Stefan Popa 2020-08-10  348  	mutex_unlock(&st->threshold_m);
84847a0a0c6314 Stefan Popa 2020-08-10  349  

84847a0a0c6314 Stefan Popa 2020-08-10 @350 return ret;
84847a0a0c6314 Stefan Popa 2020-08-10 351 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org