drivers/hwmon/nct7802.c:714:46: warning: & has lower precedence than !=; != will be evaluated first

From: kernel test robot
Date: Mon Sep 27 2021 - 19:42:38 EST


tree: https://github.com/0day-ci/linux/commits/Oskar-Senft/dt-bindings-hwmon-Add-nct7802-bindings/20210922-121927
head: 0654ba359c66a776f243b53f407f200f9e53a9ba
commit: 0654ba359c66a776f243b53f407f200f9e53a9ba hwmon: (nct7802) Make temperature sensors configurable.
date: 6 days ago
config: i386-randconfig-a016-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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/0654ba359c66a776f243b53f407f200f9e53a9ba
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Oskar-Senft/dt-bindings-hwmon-Add-nct7802-bindings/20210922-121927
git checkout 0654ba359c66a776f243b53f407f200f9e53a9ba
# 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@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/hwmon/nct7802.c:714:46: warning: & has lower precedence than !=; != will be evaluated first [-Wparentheses]
(reg >> MODE_BIT_OFFSET_RTD(index / 10) & MODE_RTD_MASK != 0x02))
^~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/nct7802.c:714:46: note: place parentheses around the '!=' expression to silence this warning
(reg >> MODE_BIT_OFFSET_RTD(index / 10) & MODE_RTD_MASK != 0x02))
^ ~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/nct7802.c:714:46: note: place parentheses around the & expression to evaluate it first
(reg >> MODE_BIT_OFFSET_RTD(index / 10) & MODE_RTD_MASK != 0x02))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
1 warning generated.


vim +714 drivers/hwmon/nct7802.c

695
696 static umode_t nct7802_temp_is_visible(struct kobject *kobj,
697 struct attribute *attr, int index)
698 {
699 struct device *dev = kobj_to_dev(kobj);
700 struct nct7802_data *data = dev_get_drvdata(dev);
701 unsigned int reg;
702 int err;
703
704 err = regmap_read(data->regmap, REG_MODE, &reg);
705 if (err < 0)
706 return 0;
707
708 if (index >= 0 && index < 20 && /* RD1, RD 2*/
709 ((reg >> MODE_BIT_OFFSET_RTD(index / 10)) & MODE_RTD_MASK) != 0x01 &&
710 ((reg >> MODE_BIT_OFFSET_RTD(index / 10)) & MODE_RTD_MASK) != 0x02)
711 return 0;
712
713 if (index >= 20 && index < 30 && /* RD3 */
> 714 (reg >> MODE_BIT_OFFSET_RTD(index / 10) & MODE_RTD_MASK != 0x02))
715 return 0;
716
717 if (index >= 30 && index < 38 && /* local */
718 (reg & MODE_LTD_EN) != MODE_LTD_EN)
719 return 0;
720
721 err = regmap_read(data->regmap, REG_PECI_ENABLE, &reg);
722 if (err < 0)
723 return 0;
724
725 if (index >= 38 && index < 46 && !(reg & 0x01)) /* PECI 0 */
726 return 0;
727
728 if (index >= 0x46 && (!(reg & 0x02))) /* PECI 1 */
729 return 0;
730
731 return attr->mode;
732 }
733

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

Attachment: .config.gz
Description: application/gzip