diff mbox series

[linux-next] scsi/ncr53c8xx: Use bitwise instead of arithmetic operator for flags

Message ID 20210820031235.12535-1-jing.yangyang@zte.com.cn (mailing list archive)
State Changes Requested
Headers show
Series [linux-next] scsi/ncr53c8xx: Use bitwise instead of arithmetic operator for flags | expand

Commit Message

CGEL Aug. 20, 2021, 3:12 a.m. UTC
From: jing yangyang <jing.yangyang@zte.com.cn>

This silences the following coccinelle warning:

"WARNING: sum of probable bitmasks, consider |"

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
---
 drivers/scsi/ncr53c8xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

kernel test robot Aug. 20, 2021, 6:07 p.m. UTC | #1
Hi CGEL,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20210819]

url:    https://github.com/0day-ci/linux/commits/CGEL/scsi-ncr53c8xx-Use-bitwise-instead-of-arithmetic-operator-for-flags/20210820-111510
base:    33e65b1f975cd2814fc0ea9617250fc4c1d7a553
config: parisc-defconfig (attached as .config)
compiler: hppa-linux-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/1c952d92c3d9f7e1609d3770e0c9194fdcf05603
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review CGEL/scsi-ncr53c8xx-Use-bitwise-instead-of-arithmetic-operator-for-flags/20210820-111510
        git checkout 1c952d92c3d9f7e1609d3770e0c9194fdcf05603
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=parisc 

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/scsi/ncr53c8xx.c: In function 'ncr_getclock':
>> drivers/scsi/ncr53c8xx.c:7913:53: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
    7913 |         if (mult > 1 && (stest1 & (DBLEN | DBLSEL)) == DBLEN | DBLSEL) {


vim +7913 drivers/scsi/ncr53c8xx.c

  7897	
  7898	/*
  7899	 *	Get/probe NCR SCSI clock frequency
  7900	 */
  7901	static void __init ncr_getclock (struct ncb *np, int mult)
  7902	{
  7903		unsigned char scntl3 = INB(nc_scntl3);
  7904		unsigned char stest1 = INB(nc_stest1);
  7905		unsigned f1;
  7906	
  7907		np->multiplier = 1;
  7908		f1 = 40000;
  7909	
  7910		/*
  7911		**	True with 875 or 895 with clock multiplier selected
  7912		*/
> 7913		if (mult > 1 && (stest1 & (DBLEN | DBLSEL)) == DBLEN | DBLSEL) {
  7914			if (bootverbose >= 2)
  7915				printk ("%s: clock multiplier found\n", ncr_name(np));
  7916			np->multiplier = mult;
  7917		}
  7918	
  7919		/*
  7920		**	If multiplier not found or scntl3 not 7,5,3,
  7921		**	reset chip and get frequency from general purpose timer.
  7922		**	Otherwise trust scntl3 BIOS setting.
  7923		*/
  7924		if (np->multiplier != mult || (scntl3 & 7) < 3 || !(scntl3 & 1)) {
  7925			unsigned f2;
  7926	
  7927			ncr_chip_reset(np, 5);
  7928	
  7929			(void) ncrgetfreq (np, 11);	/* throw away first result */
  7930			f1 = ncrgetfreq (np, 11);
  7931			f2 = ncrgetfreq (np, 11);
  7932	
  7933			if(bootverbose)
  7934				printk ("%s: NCR clock is %uKHz, %uKHz\n", ncr_name(np), f1, f2);
  7935	
  7936			if (f1 > f2) f1 = f2;		/* trust lower result	*/
  7937	
  7938			if	(f1 <	45000)		f1 =  40000;
  7939			else if (f1 <	55000)		f1 =  50000;
  7940			else				f1 =  80000;
  7941	
  7942			if (f1 < 80000 && mult > 1) {
  7943				if (bootverbose >= 2)
  7944					printk ("%s: clock multiplier assumed\n", ncr_name(np));
  7945				np->multiplier	= mult;
  7946			}
  7947		} else {
  7948			if	((scntl3 & 7) == 3)	f1 =  40000;
  7949			else if	((scntl3 & 7) == 5)	f1 =  80000;
  7950			else 				f1 = 160000;
  7951	
  7952			f1 /= np->multiplier;
  7953		}
  7954	
  7955		/*
  7956		**	Compute controller synchronous parameters.
  7957		*/
  7958		f1		*= np->multiplier;
  7959		np->clock_khz	= f1;
  7960	}
  7961	

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

Patch

diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 09958f7..5c27afb 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -7910,7 +7910,7 @@  static void __init ncr_getclock (struct ncb *np, int mult)
 	/*
 	**	True with 875 or 895 with clock multiplier selected
 	*/
-	if (mult > 1 && (stest1 & (DBLEN+DBLSEL)) == DBLEN+DBLSEL) {
+	if (mult > 1 && (stest1 & (DBLEN | DBLSEL)) == DBLEN | DBLSEL) {
 		if (bootverbose >= 2)
 			printk ("%s: clock multiplier found\n", ncr_name(np));
 		np->multiplier = mult;