drivers/rtc/rtc-pcf85063.c:292:40: warning: Clarify calculation precedence for '&' and

From: kernel test robot
Date: Thu Jul 30 2020 - 01:31:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d3590ebf6f91350192737dd1d1b219c05277f067
commit: f86dc5bde18e540743eaef20529d9f2b67283abd rtc: pcf85063: return meaningful value for RTC_VL_READ
date: 8 months ago
compiler: or1k-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


cppcheck warnings: (new ones prefixed by >>)

>> drivers/rtc/rtc-pcf85063.c:292:40: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
status = status & PCF85063_REG_SC_OS ? RTC_VL_DATA_INVALID : 0;
^

vim +292 drivers/rtc/rtc-pcf85063.c

279
280 static int pcf85063_ioctl(struct device *dev, unsigned int cmd,
281 unsigned long arg)
282 {
283 struct pcf85063 *pcf85063 = dev_get_drvdata(dev);
284 int status, ret = 0;
285
286 switch (cmd) {
287 case RTC_VL_READ:
288 ret = regmap_read(pcf85063->regmap, PCF85063_REG_SC, &status);
289 if (ret < 0)
290 return ret;
291
> 292 status = status & PCF85063_REG_SC_OS ? RTC_VL_DATA_INVALID : 0;
293
294 return put_user(status, (unsigned int __user *)arg);
295
296 default:
297 return -ENOIOCTLCMD;
298 }
299 }
300

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