lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202109301229.MsQS5fwI-lkp@intel.com>
Date:   Thu, 30 Sep 2021 12:25:46 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hannes Reinecke <hare@...e.de>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [hare-scsi-devel:scsi-result.v1 93/170]
 drivers/scsi/qlogicfas408.c:263:22: warning: variable 'result' set but not
 used

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git scsi-result.v1
head:   8b1a0adf66803c2d24951496a97bfe401d17b777
commit: 041da41fe006ccff222ee1fc53861955577d28e9 [93/170] qlogicfac408: set SCSI result during ql_pcmd()
config: arc-allyesconfig (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://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=041da41fe006ccff222ee1fc53861955577d28e9
        git remote add hare-scsi-devel https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
        git fetch --no-tags hare-scsi-devel scsi-result.v1
        git checkout 041da41fe006ccff222ee1fc53861955577d28e9
        # 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@...el.com>

All warnings (new ones prefixed by >>):

   drivers/scsi/qlogicfas408.c: In function 'ql_pcmd':
>> drivers/scsi/qlogicfas408.c:263:22: warning: variable 'result' set but not used [-Wunused-but-set-variable]
     263 |         unsigned int result;    /* ultimate return result */
         |                      ^~~~~~


vim +/result +263 drivers/scsi/qlogicfas408.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  254  
^1da177e4c3f41 Linus Torvalds  2005-04-16  255  /*
^1da177e4c3f41 Linus Torvalds  2005-04-16  256   *	Process scsi command - usually after interrupt 
^1da177e4c3f41 Linus Torvalds  2005-04-16  257   */
^1da177e4c3f41 Linus Torvalds  2005-04-16  258  
041da41fe006cc Hannes Reinecke 2020-12-01  259  static void ql_pcmd(struct scsi_cmnd *cmd)
^1da177e4c3f41 Linus Torvalds  2005-04-16  260  {
^1da177e4c3f41 Linus Torvalds  2005-04-16  261  	unsigned int i, j;
^1da177e4c3f41 Linus Torvalds  2005-04-16  262  	unsigned long k;
^1da177e4c3f41 Linus Torvalds  2005-04-16 @263  	unsigned int result;	/* ultimate return result */
^1da177e4c3f41 Linus Torvalds  2005-04-16  264  	unsigned int status;	/* scsi returned status */
^1da177e4c3f41 Linus Torvalds  2005-04-16  265  	unsigned int message;	/* scsi returned message */
^1da177e4c3f41 Linus Torvalds  2005-04-16  266  	unsigned int phase;	/* recorded scsi phase */
^1da177e4c3f41 Linus Torvalds  2005-04-16  267  	unsigned int reqlen;	/* total length of transfer */
^1da177e4c3f41 Linus Torvalds  2005-04-16  268  	char *buf;
^1da177e4c3f41 Linus Torvalds  2005-04-16  269  	struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
^1da177e4c3f41 Linus Torvalds  2005-04-16  270  	int qbase = priv->qbase;
^1da177e4c3f41 Linus Torvalds  2005-04-16  271  	int int_type = priv->int_type;
^1da177e4c3f41 Linus Torvalds  2005-04-16  272  
^1da177e4c3f41 Linus Torvalds  2005-04-16  273  	rtrc(1)
^1da177e4c3f41 Linus Torvalds  2005-04-16  274  	j = inb(qbase + 6);
^1da177e4c3f41 Linus Torvalds  2005-04-16  275  	i = inb(qbase + 5);
^1da177e4c3f41 Linus Torvalds  2005-04-16  276  	if (i == 0x20) {
041da41fe006cc Hannes Reinecke 2020-12-01  277  		set_host_byte(cmd, DID_NO_CONNECT);
041da41fe006cc Hannes Reinecke 2020-12-01  278  		return;
^1da177e4c3f41 Linus Torvalds  2005-04-16  279  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  280  	i |= inb(qbase + 5);	/* the 0x10 bit can be set after the 0x08 */
^1da177e4c3f41 Linus Torvalds  2005-04-16  281  	if (i != 0x18) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  282  		printk(KERN_ERR "Ql:Bad Interrupt status:%02x\n", i);
^1da177e4c3f41 Linus Torvalds  2005-04-16  283  		ql_zap(priv);
041da41fe006cc Hannes Reinecke 2020-12-01  284  		set_host_byte(cmd, DID_BAD_INTR);
041da41fe006cc Hannes Reinecke 2020-12-01  285  		return;
^1da177e4c3f41 Linus Torvalds  2005-04-16  286  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  287  	j &= 7;			/* j = inb( qbase + 7 ) >> 5; */
^1da177e4c3f41 Linus Torvalds  2005-04-16  288  
^1da177e4c3f41 Linus Torvalds  2005-04-16  289  	/* correct status is supposed to be step 4 */
^1da177e4c3f41 Linus Torvalds  2005-04-16  290  	/* it sometimes returns step 3 but with 0 bytes left to send */
^1da177e4c3f41 Linus Torvalds  2005-04-16  291  	/* We can try stuffing the FIFO with the max each time, but we will get a
^1da177e4c3f41 Linus Torvalds  2005-04-16  292  	   sequence of 3 if any bytes are left (but we do flush the FIFO anyway */
^1da177e4c3f41 Linus Torvalds  2005-04-16  293  
^1da177e4c3f41 Linus Torvalds  2005-04-16  294  	if (j != 3 && j != 4) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  295  		printk(KERN_ERR "Ql:Bad sequence for command %d, int %02X, cmdleft = %d\n",
^1da177e4c3f41 Linus Torvalds  2005-04-16  296  		     j, i, inb(qbase + 7) & 0x1f);
^1da177e4c3f41 Linus Torvalds  2005-04-16  297  		ql_zap(priv);
041da41fe006cc Hannes Reinecke 2020-12-01  298  		set_host_byte(cmd, DID_ERROR);
041da41fe006cc Hannes Reinecke 2020-12-01  299  		return;
^1da177e4c3f41 Linus Torvalds  2005-04-16  300  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  301  	result = DID_OK;
^1da177e4c3f41 Linus Torvalds  2005-04-16  302  	if (inb(qbase + 7) & 0x1f)	/* if some bytes in fifo */
^1da177e4c3f41 Linus Torvalds  2005-04-16  303  		outb(1, qbase + 3);	/* clear fifo */
^1da177e4c3f41 Linus Torvalds  2005-04-16  304  	/* note that request_bufflen is the total xfer size when sg is used */
bc1ebfba1a3a27 FUJITA Tomonori 2007-05-14  305  	reqlen = scsi_bufflen(cmd);
^1da177e4c3f41 Linus Torvalds  2005-04-16  306  	/* note that it won't work if transfers > 16M are requested */
^1da177e4c3f41 Linus Torvalds  2005-04-16  307  	if (reqlen && !((phase = inb(qbase + 4)) & 6)) {	/* data phase */
bc1ebfba1a3a27 FUJITA Tomonori 2007-05-14  308  		struct scatterlist *sg;
^1da177e4c3f41 Linus Torvalds  2005-04-16  309  		rtrc(2)
^1da177e4c3f41 Linus Torvalds  2005-04-16  310  		outb(reqlen, qbase);	/* low-mid xfer cnt */
^1da177e4c3f41 Linus Torvalds  2005-04-16  311  		outb(reqlen >> 8, qbase + 1);	/* low-mid xfer cnt */
^1da177e4c3f41 Linus Torvalds  2005-04-16  312  		outb(reqlen >> 16, qbase + 0xe);	/* high xfer cnt */
^1da177e4c3f41 Linus Torvalds  2005-04-16  313  		outb(0x90, qbase + 3);	/* command do xfer */
^1da177e4c3f41 Linus Torvalds  2005-04-16  314  		/* PIO pseudo DMA to buffer or sglist */
^1da177e4c3f41 Linus Torvalds  2005-04-16  315  		REG1;
bc1ebfba1a3a27 FUJITA Tomonori 2007-05-14  316  
bc1ebfba1a3a27 FUJITA Tomonori 2007-05-14  317  		scsi_for_each_sg(cmd, sg, scsi_sg_count(cmd), i) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  318  			if (priv->qabort) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  319  				REG0;
041da41fe006cc Hannes Reinecke 2020-12-01  320  				if (priv->qabort == 1)
041da41fe006cc Hannes Reinecke 2020-12-01  321  					set_host_byte(cmd, DID_ABORT);
041da41fe006cc Hannes Reinecke 2020-12-01  322  				else
041da41fe006cc Hannes Reinecke 2020-12-01  323  					set_host_byte(cmd, DID_RESET);
041da41fe006cc Hannes Reinecke 2020-12-01  324  				return;
^1da177e4c3f41 Linus Torvalds  2005-04-16  325  			}
45711f1af6eff1 Jens Axboe      2007-10-22  326  			buf = sg_virt(sg);
bc1ebfba1a3a27 FUJITA Tomonori 2007-05-14  327  			if (ql_pdma(priv, phase, buf, sg->length))
^1da177e4c3f41 Linus Torvalds  2005-04-16  328  				break;
^1da177e4c3f41 Linus Torvalds  2005-04-16  329  		}
^1da177e4c3f41 Linus Torvalds  2005-04-16  330  		REG0;
^1da177e4c3f41 Linus Torvalds  2005-04-16  331  		rtrc(2)
^1da177e4c3f41 Linus Torvalds  2005-04-16  332  		/*
^1da177e4c3f41 Linus Torvalds  2005-04-16  333  		 *	Wait for irq (split into second state of irq handler
^1da177e4c3f41 Linus Torvalds  2005-04-16  334  		 *	if this can take time)
^1da177e4c3f41 Linus Torvalds  2005-04-16  335  		 */
041da41fe006cc Hannes Reinecke 2020-12-01  336  		if ((k = ql_wai(priv))) {
041da41fe006cc Hannes Reinecke 2020-12-01  337  			set_host_byte(cmd, k);
041da41fe006cc Hannes Reinecke 2020-12-01  338  			return;
041da41fe006cc Hannes Reinecke 2020-12-01  339  		}
^1da177e4c3f41 Linus Torvalds  2005-04-16  340  		k = inb(qbase + 5);	/* should be 0x10, bus service */
^1da177e4c3f41 Linus Torvalds  2005-04-16  341  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  342  
^1da177e4c3f41 Linus Torvalds  2005-04-16  343  	/*
^1da177e4c3f41 Linus Torvalds  2005-04-16  344  	 *	Enter Status (and Message In) Phase
^1da177e4c3f41 Linus Torvalds  2005-04-16  345  	 */
^1da177e4c3f41 Linus Torvalds  2005-04-16  346  
^1da177e4c3f41 Linus Torvalds  2005-04-16  347  	k = jiffies + WATCHDOG;
^1da177e4c3f41 Linus Torvalds  2005-04-16  348  
^1da177e4c3f41 Linus Torvalds  2005-04-16  349  	while (time_before(jiffies, k) && !priv->qabort &&
^1da177e4c3f41 Linus Torvalds  2005-04-16  350  						!(inb(qbase + 4) & 6))
^1da177e4c3f41 Linus Torvalds  2005-04-16  351  		cpu_relax();	/* wait for status phase */
^1da177e4c3f41 Linus Torvalds  2005-04-16  352  
^1da177e4c3f41 Linus Torvalds  2005-04-16  353  	if (time_after_eq(jiffies, k)) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  354  		ql_zap(priv);
041da41fe006cc Hannes Reinecke 2020-12-01  355  		set_host_byte(cmd, DID_TIME_OUT);
041da41fe006cc Hannes Reinecke 2020-12-01  356  		return;
^1da177e4c3f41 Linus Torvalds  2005-04-16  357  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  358  
^1da177e4c3f41 Linus Torvalds  2005-04-16  359  	/* FIXME: timeout ?? */
^1da177e4c3f41 Linus Torvalds  2005-04-16  360  	while (inb(qbase + 5))
^1da177e4c3f41 Linus Torvalds  2005-04-16  361  		cpu_relax();	/* clear pending ints */
^1da177e4c3f41 Linus Torvalds  2005-04-16  362  
041da41fe006cc Hannes Reinecke 2020-12-01  363  	if (priv->qabort) {
041da41fe006cc Hannes Reinecke 2020-12-01  364  		if (priv->qabort == 1)
041da41fe006cc Hannes Reinecke 2020-12-01  365  			set_host_byte(cmd, DID_ABORT);
041da41fe006cc Hannes Reinecke 2020-12-01  366  		else
041da41fe006cc Hannes Reinecke 2020-12-01  367  			set_host_byte(cmd, DID_RESET);
041da41fe006cc Hannes Reinecke 2020-12-01  368  		return;
041da41fe006cc Hannes Reinecke 2020-12-01  369  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  370  	outb(0x11, qbase + 3);	/* get status and message */
041da41fe006cc Hannes Reinecke 2020-12-01  371  	if ((k = ql_wai(priv))) {
041da41fe006cc Hannes Reinecke 2020-12-01  372  		set_host_byte(cmd, k);
041da41fe006cc Hannes Reinecke 2020-12-01  373  		return;
041da41fe006cc Hannes Reinecke 2020-12-01  374  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  375  	i = inb(qbase + 5);	/* get chip irq stat */
^1da177e4c3f41 Linus Torvalds  2005-04-16  376  	j = inb(qbase + 7) & 0x1f;	/* and bytes rec'd */
^1da177e4c3f41 Linus Torvalds  2005-04-16  377  	status = inb(qbase + 2);
^1da177e4c3f41 Linus Torvalds  2005-04-16  378  	message = inb(qbase + 2);
^1da177e4c3f41 Linus Torvalds  2005-04-16  379  
^1da177e4c3f41 Linus Torvalds  2005-04-16  380  	/*
^1da177e4c3f41 Linus Torvalds  2005-04-16  381  	 *	Should get function complete int if Status and message, else 
^1da177e4c3f41 Linus Torvalds  2005-04-16  382  	 *	bus serv if only status 
^1da177e4c3f41 Linus Torvalds  2005-04-16  383  	 */
^1da177e4c3f41 Linus Torvalds  2005-04-16  384  	if (!((i == 8 && j == 2) || (i == 0x10 && j == 1))) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  385  		printk(KERN_ERR "Ql:Error during status phase, int=%02X, %d bytes recd\n", i, j);
041da41fe006cc Hannes Reinecke 2020-12-01  386  		set_host_byte(cmd, DID_ERROR);
^1da177e4c3f41 Linus Torvalds  2005-04-16  387  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  388  	outb(0x12, qbase + 3);	/* done, disconnect */
^1da177e4c3f41 Linus Torvalds  2005-04-16  389  	rtrc(1)
041da41fe006cc Hannes Reinecke 2020-12-01  390  	if ((k = ql_wai(priv))) {
041da41fe006cc Hannes Reinecke 2020-12-01  391  		set_host_byte(cmd, k);
041da41fe006cc Hannes Reinecke 2020-12-01  392  		return;
041da41fe006cc Hannes Reinecke 2020-12-01  393  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  394  
^1da177e4c3f41 Linus Torvalds  2005-04-16  395  	/*
^1da177e4c3f41 Linus Torvalds  2005-04-16  396  	 *	Should get bus service interrupt and disconnect interrupt 
^1da177e4c3f41 Linus Torvalds  2005-04-16  397  	 */
^1da177e4c3f41 Linus Torvalds  2005-04-16  398  
^1da177e4c3f41 Linus Torvalds  2005-04-16  399  	i = inb(qbase + 5);	/* should be bus service */
^1da177e4c3f41 Linus Torvalds  2005-04-16  400  	while (!priv->qabort && ((i & 0x20) != 0x20)) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  401  		barrier();
^1da177e4c3f41 Linus Torvalds  2005-04-16  402  		cpu_relax();
^1da177e4c3f41 Linus Torvalds  2005-04-16  403  		i |= inb(qbase + 5);
^1da177e4c3f41 Linus Torvalds  2005-04-16  404  	}
^1da177e4c3f41 Linus Torvalds  2005-04-16  405  	rtrc(0)
^1da177e4c3f41 Linus Torvalds  2005-04-16  406  
041da41fe006cc Hannes Reinecke 2020-12-01  407  	if (priv->qabort) {
041da41fe006cc Hannes Reinecke 2020-12-01  408  		if (priv->qabort == 1)
041da41fe006cc Hannes Reinecke 2020-12-01  409  			set_host_byte(cmd, DID_ABORT);
041da41fe006cc Hannes Reinecke 2020-12-01  410  		else
041da41fe006cc Hannes Reinecke 2020-12-01  411  			set_host_byte(cmd, DID_RESET);
041da41fe006cc Hannes Reinecke 2020-12-01  412  		return;
041da41fe006cc Hannes Reinecke 2020-12-01  413  	}
041da41fe006cc Hannes Reinecke 2020-12-01  414  	set_msg_byte(cmd, message);
041da41fe006cc Hannes Reinecke 2020-12-01  415  	set_status_byte(cmd, status);
^1da177e4c3f41 Linus Torvalds  2005-04-16  416  }
^1da177e4c3f41 Linus Torvalds  2005-04-16  417  

:::::: The code at line 263 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@...970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@...970.osdl.org>

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

Download attachment ".config.gz" of type "application/gzip" (66470 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ