From: kernel test robot <lkp@intel.com>
To: Daniel Matyas <daniel.matyas@analog.com>
Cc: oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Guenter Roeck <linux@roeck-us.net>
Subject: [linux-next:master 6248/7300] drivers/hwmon/max31827.c:394:16: sparse: sparse: dubious: x & !y
Date: Thu, 14 Dec 2023 06:30:06 +0800 [thread overview]
Message-ID: <202312140633.nmHowPIh-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 48e8992e33abf054bcc0bb2e77b2d43bb899212e
commit: 88548710d2aed71677f7594a78219bf081d4297f [6248/7300] hwmon: (max31827) Handle new properties from the devicetree
config: arc-randconfig-r131-20231212 (https://download.01.org/0day-ci/archive/20231214/202312140633.nmHowPIh-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231214/202312140633.nmHowPIh-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/202312140633.nmHowPIh-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/hwmon/max31827.c:394:16: sparse: sparse: dubious: x & !y
drivers/hwmon/max31827.c:401:24: sparse: sparse: dubious: x & !y
vim +394 drivers/hwmon/max31827.c
373
374 static int max31827_init_client(struct max31827_state *st,
375 struct device *dev)
376 {
377 struct fwnode_handle *fwnode;
378 unsigned int res = 0;
379 u32 data, lsb_idx;
380 bool prop;
381 int ret;
382
383 fwnode = dev_fwnode(dev);
384
385 st->enable = true;
386 res |= MAX31827_DEVICE_ENABLE(1);
387
388 res |= MAX31827_CONFIGURATION_RESOLUTION_MASK;
389
390 prop = fwnode_property_read_bool(fwnode, "adi,comp-int");
391 res |= FIELD_PREP(MAX31827_CONFIGURATION_COMP_INT_MASK, prop);
392
393 prop = fwnode_property_read_bool(fwnode, "adi,timeout-enable");
> 394 res |= FIELD_PREP(MAX31827_CONFIGURATION_TIMEOUT_MASK, !prop);
395
396 if (fwnode_property_present(fwnode, "adi,alarm-pol")) {
397 ret = fwnode_property_read_u32(fwnode, "adi,alarm-pol", &data);
398 if (ret)
399 return ret;
400
401 res |= FIELD_PREP(MAX31827_CONFIGURATION_ALRM_POL_MASK, !!data);
402 } else {
403 /*
404 * Set default value.
405 */
406 res |= FIELD_PREP(MAX31827_CONFIGURATION_ALRM_POL_MASK,
407 MAX31827_ALRM_POL_LOW);
408 }
409
410 if (fwnode_property_present(fwnode, "adi,fault-q")) {
411 ret = fwnode_property_read_u32(fwnode, "adi,fault-q", &data);
412 if (ret)
413 return ret;
414
415 /*
416 * Convert the desired fault queue into register bits.
417 */
418 if (data != 0)
419 lsb_idx = __ffs(data);
420
421 if (hweight32(data) != 1 || lsb_idx > 4) {
422 dev_err(dev, "Invalid data in adi,fault-q\n");
423 return -EINVAL;
424 }
425
426 res |= FIELD_PREP(MAX31827_CONFIGURATION_FLT_Q_MASK, lsb_idx);
427 } else {
428 /*
429 * Set default value.
430 */
431 res |= FIELD_PREP(MAX31827_CONFIGURATION_FLT_Q_MASK,
432 MAX31827_FLT_Q_1);
433 }
434
435 return regmap_write(st->regmap, MAX31827_CONFIGURATION_REG, res);
436 }
437
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-12-13 22:30 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=202312140633.nmHowPIh-lkp@intel.com \
--to=lkp@intel.com \
--cc=daniel.matyas@analog.com \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.