[groeck-staging:hwmon-staging 111/143] drivers/hwmon/lm95234.c:223:7: warning: variable 'ret' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-staging
head:   80e45111b670e9c913398f5ad54196a99a739497
commit: 85a6f963ad7f3657dff782c3e3ac40ab6c95f62c [111/143] hwmon: (lm9534) Convert to with_info hwmon API
config: i386-buildonly-randconfig-002-20240713 (https://download.01.org/0day-ci/archive/20240713/202407130915.X917zHwW-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240713/202407130915.X917zHwW-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/202407130915.X917zHwW-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/hwmon/lm95234.c:223:7: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
     223 |                 if (ret)
         |                     ^~~
   drivers/hwmon/lm95234.c:183:9: note: initialize the variable 'ret' to silence this warning
     183 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +/ret +223 drivers/hwmon/lm95234.c

   177	
   178	static int lm95234_temp_read(struct device *dev, u32 attr, int channel, long *val)
   179	{
   180		struct lm95234_data *data = dev_get_drvdata(dev);
   181		struct regmap *regmap = data->regmap;
   182		u32 regval, mask;
   183		int ret;
   184	
   185		switch (attr) {
   186		case hwmon_temp_input:
   187			return lm95234_read_temp(regmap, channel, val);
   188		case hwmon_temp_max_alarm:
   189			ret =  regmap_read(regmap, lm95234_alarm_reg(channel), &regval);
   190			if (ret)
   191				return ret;
   192			*val = !!(regval & BIT(channel));
   193			break;
   194		case hwmon_temp_crit_alarm:
   195			ret =  regmap_read(regmap, LM95234_REG_STS_TCRIT1, &regval);
   196			if (ret)
   197				return ret;
   198			*val = !!(regval & BIT(channel));
   199			break;
   200		case hwmon_temp_crit_hyst:
   201			return lm95234_hyst_get(data, LM95234_REG_TCRIT1(channel), val);
   202		case hwmon_temp_type:
   203			ret = regmap_read(regmap, LM95234_REG_REM_MODEL, &regval);
   204			if (ret)
   205				return ret;
   206			*val = (regval & BIT(channel)) ? 1 : 2;
   207			break;
   208		case hwmon_temp_offset:
   209			ret = regmap_read(regmap, LM95234_REG_OFFSET(channel - 1), &regval);
   210			if (ret)
   211				return ret;
   212			*val = sign_extend32(regval, 7) * 500;
   213			break;
   214		case hwmon_temp_fault:
   215			ret = regmap_read(regmap, LM95234_REG_STS_FAULT, &regval);
   216			if (ret)
   217				return ret;
   218			mask = (BIT(0) | BIT(1)) << ((channel - 1) << 1);
   219			*val = !!(regval & mask);
   220			break;
   221		case hwmon_temp_max:
   222			regmap_read(regmap, lm95234_crit_reg(channel), &regval);
 > 223			if (ret)
   224				return ret;
   225			*val = regval * 1000;
   226			break;
   227		case hwmon_temp_max_hyst:
   228			return lm95234_hyst_get(data, lm95234_crit_reg(channel), val);
   229		case hwmon_temp_crit:
   230			regmap_read(regmap, LM95234_REG_TCRIT1(channel), &regval);
   231			if (ret)
   232				return ret;
   233			*val = regval * 1000;
   234			break;
   235		default:
   236			return -EOPNOTSUPP;
   237		}
   238		return 0;
   239	}
   240	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux