drivers/hwmon/nct7802.c:714:53: warning: suggest parentheses around comparison in operand of '&'

From: kernel test robot
Date: Mon Sep 27 2021 - 18:51:44 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: arc-randconfig-r043-20210927 (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
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=gcc-11.2.0 make.cross ARCH=arc

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: In function 'nct7802_temp_is_visible':
>> drivers/hwmon/nct7802.c:714:53: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
714 | (reg >> MODE_BIT_OFFSET_RTD(index / 10) & MODE_RTD_MASK != 0x02))
| ^


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