linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] scsi/ncr53c8xx: Use bitwise instead of arithmetic operator for flags
@ 2021-08-20  3:12 CGEL
  2021-08-20 18:07 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-20  3:12 UTC (permalink / raw)
  To: James E . J . Bottomley
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, jing yangyang, Zeal Robot

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(-)

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;
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] scsi/ncr53c8xx: Use bitwise instead of arithmetic operator for flags
  2021-08-20  3:12 [PATCH linux-next] scsi/ncr53c8xx: Use bitwise instead of arithmetic operator for flags CGEL
@ 2021-08-20 18:07 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-20 18:07 UTC (permalink / raw)
  To: CGEL, James E . J . Bottomley
  Cc: kbuild-all, Martin K . Petersen, linux-scsi, linux-kernel,
	jing yangyang, Zeal Robot

[-- Attachment #1: Type: text/plain, Size: 3558 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 18850 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-20 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20  3:12 [PATCH linux-next] scsi/ncr53c8xx: Use bitwise instead of arithmetic operator for flags CGEL
2021-08-20 18:07 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).