public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-hwmon@vger.kernel.org
Subject: [groeck-staging:hwmon-staging 111/143] drivers/hwmon/lm95234.c:223:7: warning: variable 'ret' is uninitialized when used here
Date: Sat, 13 Jul 2024 09:28:04 +0800	[thread overview]
Message-ID: <202407130915.X917zHwW-lkp@intel.com> (raw)

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@intel.com/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@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/202407130915.X917zHwW-lkp@intel.com/

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

                 reply	other threads:[~2024-07-13  1:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202407130915.X917zHwW-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox