From: kernel test robot <lkp@intel.com>
To: Nathan Rossi <nathan@nathanrossi.com>,
linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
Nathan Rossi <nathan@nathanrossi.com>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH 2/2] hwmon: Driver for Texas Instruments INA238
Date: Wed, 27 Oct 2021 17:32:46 +0800 [thread overview]
Message-ID: <202110271706.UZ3VxyHp-lkp@intel.com> (raw)
In-Reply-To: <20211025025805.618566-2-nathan@nathanrossi.com>
[-- Attachment #1: Type: text/plain, Size: 4417 bytes --]
Hi Nathan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on v5.15-rc7 next-20211026]
[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]
url: https://github.com/0day-ci/linux/commits/Nathan-Rossi/Driver-for-TI-INA238-I2C-Power-Monitor/20211025-105911
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: i386-randconfig-r006-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/aafb1ad1e44aa2604f4d8cd8db258d36fcefadfc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nathan-Rossi/Driver-for-TI-INA238-I2C-Power-Monitor/20211025-105911
git checkout aafb1ad1e44aa2604f4d8cd8db258d36fcefadfc
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/hwmon/ina238.c:297:2: warning: variable 'regval' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/hwmon/ina238.c:304:48: note: uninitialized use occurs here
ret = regmap_write(data->regmap, attr->index, regval);
^~~~~~
drivers/hwmon/ina238.c:250:12: note: initialize the variable 'regval' to silence this warning
int regval;
^
= 0
1 warning generated.
vim +/regval +297 drivers/hwmon/ina238.c
242
243 static ssize_t ina238_alert_store(struct device *dev,
244 struct device_attribute *da,
245 const char *buf, size_t count)
246 {
247 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
248 struct ina238_data *data = dev_get_drvdata(dev);
249 long long val;
250 int regval;
251 int ret;
252
253 ret = kstrtoll(buf, 10, &val);
254 if (ret < 0)
255 return ret;
256
257 /* convert decimal to register value */
258 switch (attr->index) {
259 case INA238_SHUNT_OVER_VOLTAGE:
260 case INA238_SHUNT_UNDER_VOLTAGE:
261 /* signed */
262 regval = div_s64((val * 1000), INA238_SHUNT_VOLTAGE_LSB);
263 if (regval > S16_MAX || regval < S16_MIN) {
264 ret = -EINVAL;
265 goto abort;
266 }
267 break;
268 case INA238_BUS_OVER_VOLTAGE:
269 case INA238_BUS_UNDER_VOLTAGE:
270 regval = div_u64((val * 1000), INA238_BUS_VOLTAGE_LSB);
271 if (regval > U16_MAX || regval < 0) {
272 ret = -EINVAL;
273 goto abort;
274 }
275 break;
276 case INA238_POWER_LIMIT:
277 /*
278 * Compared against the 24-bit power register, lower 8-bits are
279 * truncated. Same conversion to/from uW as POWER register.
280 */
281 regval = div_u64(val * 5 * data->rshunt,
282 1000 * INA238_FIXED_SHUNT) >> 8;
283 if (regval > U16_MAX || regval < 0) {
284 ret = -EINVAL;
285 goto abort;
286 }
287 break;
288 case INA238_TEMP_LIMIT:
289 /* Bits 15-4 of register */
290 regval = (div_s64(val, INA238_DIE_TEMP_LSB) << 4);
291 if (regval > S16_MAX || regval < S16_MIN) {
292 ret = -EINVAL;
293 goto abort;
294 }
295 regval = regval & 0xfff0;
296 break;
> 297 default:
298 WARN_ON_ONCE(1);
299 break;
300 }
301
302 mutex_lock(&data->config_lock);
303
304 ret = regmap_write(data->regmap, attr->index, regval);
305 if (ret < 0)
306 goto abort;
307
308 ret = count;
309 abort:
310 mutex_unlock(&data->config_lock);
311 return ret;
312 }
313
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31277 bytes --]
next prev parent reply other threads:[~2021-10-27 9:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 2:58 [PATCH 0/2] Driver for TI INA238 I2C Power Monitor Nathan Rossi
2021-10-25 2:58 ` [PATCH 2/2] hwmon: Driver for Texas Instruments INA238 Nathan Rossi
2021-10-25 5:06 ` Guenter Roeck
2021-10-25 6:27 ` Nathan Rossi
2021-10-25 15:45 ` Guenter Roeck
2021-10-26 7:54 ` Nathan Rossi
2021-10-27 9:32 ` kernel test robot [this message]
2021-11-03 14:52 ` Dan Carpenter
2021-10-25 2:58 ` [PATCH 1/2] dt-bindings: hwmon: ti,ina2xx: Document ti,ina238 compatible string Nathan Rossi
2021-10-27 7:42 ` [PATCH v2 0/3] Driver for TI INA238 I2C Power Monitor Nathan Rossi
2021-10-27 7:42 ` [PATCH v2 2/3] dt-bindings: hwmon: ti,ina2xx: Add ti,shunt-gain property Nathan Rossi
2021-10-27 14:12 ` Rob Herring
2021-10-27 7:42 ` [PATCH v2 3/3] hwmon: Driver for Texas Instruments INA238 Nathan Rossi
2021-10-27 15:56 ` Guenter Roeck
2021-10-27 7:42 ` [PATCH v2 1/3] dt-bindings: hwmon: ti,ina2xx: Document ti,ina238 compatible string Nathan Rossi
2021-10-27 15:57 ` [PATCH v2 0/3] Driver for TI INA238 I2C Power Monitor Guenter Roeck
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=202110271706.UZ3VxyHp-lkp@intel.com \
--to=lkp@intel.com \
--cc=corbet@lwn.net \
--cc=jdelvare@suse.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=llvm@lists.linux.dev \
--cc=nathan@nathanrossi.com \
/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