linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 1527/2770] drivers/char/pcmcia/cm4000_cs.c:569:16: warning: iteration 4 invokes undefined behavior
@ 2021-05-13  8:52 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-05-13  8:52 UTC (permalink / raw)
  To: Niklas Schnelle; +Cc: kbuild-all, Linux Memory Management List, Arnd Bergmann

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ec2618180c3450d06a6a4ba951d4c9a2c689b517
commit: 5ae6eadfdaf431f47adbdf1754f3b5a5fd638de2 [1527/2770] asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE
config: m68k-randconfig-r035-20210513 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.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/next/linux-next.git/commit/?id=5ae6eadfdaf431f47adbdf1754f3b5a5fd638de2
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 5ae6eadfdaf431f47adbdf1754f3b5a5fd638de2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=m68k 

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/char/pcmcia/cm4000_cs.c: In function 'cmm_write':
   drivers/char/pcmcia/cm4000_cs.c:1053:16: warning: variable 'tmp' set but not used [-Wunused-but-set-variable]
    1053 |  unsigned char tmp;
         |                ^~~
   drivers/char/pcmcia/cm4000_cs.c: In function 'set_protocol':
>> drivers/char/pcmcia/cm4000_cs.c:569:16: warning: iteration 4 invokes undefined behavior [-Waggressive-loop-optimizations]
     569 |   pts_reply[i] = inb(REG_BUF_DATA(iobase));
         |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/char/pcmcia/cm4000_cs.c:567:2: note: within this loop
     567 |  for (i = 0; i < num_bytes_read; i++) {
         |  ^~~


vim +569 drivers/char/pcmcia/cm4000_cs.c

c1986ee9bea3d8 Harald Welte 2005-11-13  516  
c1986ee9bea3d8 Harald Welte 2005-11-13  517  	/* set number of bytes to write */
c1986ee9bea3d8 Harald Welte 2005-11-13  518  	DEBUGP(5, dev, "Set number of bytes to write\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  519  	xoutb(0x04, REG_NUM_SEND(iobase));
c1986ee9bea3d8 Harald Welte 2005-11-13  520  
c1986ee9bea3d8 Harald Welte 2005-11-13  521  	/* Trigger CARDMAN CONTROLLER */
c1986ee9bea3d8 Harald Welte 2005-11-13  522  	xoutb(0x50, REG_FLAGS0(iobase));
c1986ee9bea3d8 Harald Welte 2005-11-13  523  
c1986ee9bea3d8 Harald Welte 2005-11-13  524  	/* Monitor progress */
c1986ee9bea3d8 Harald Welte 2005-11-13  525  	/* wait for xmit done */
c1986ee9bea3d8 Harald Welte 2005-11-13  526  	DEBUGP(5, dev, "Waiting for NumRecBytes getting valid\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  527  
c1986ee9bea3d8 Harald Welte 2005-11-13  528  	for (i = 0; i < 100; i++) {
c1986ee9bea3d8 Harald Welte 2005-11-13  529  		if (inb(REG_FLAGS0(iobase)) & 0x08) {
c1986ee9bea3d8 Harald Welte 2005-11-13  530  			DEBUGP(5, dev, "NumRecBytes is valid\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  531  			break;
c1986ee9bea3d8 Harald Welte 2005-11-13  532  		}
be826ada52f1fc Jia-Ju Bai   2018-03-18  533  		usleep_range(10000, 11000);
c1986ee9bea3d8 Harald Welte 2005-11-13  534  	}
c1986ee9bea3d8 Harald Welte 2005-11-13  535  	if (i == 100) {
c1986ee9bea3d8 Harald Welte 2005-11-13  536  		DEBUGP(5, dev, "Timeout waiting for NumRecBytes getting "
c1986ee9bea3d8 Harald Welte 2005-11-13  537  		       "valid\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  538  		rc = -EIO;
c1986ee9bea3d8 Harald Welte 2005-11-13  539  		goto exit_setprotocol;
c1986ee9bea3d8 Harald Welte 2005-11-13  540  	}
c1986ee9bea3d8 Harald Welte 2005-11-13  541  
c1986ee9bea3d8 Harald Welte 2005-11-13  542  	DEBUGP(5, dev, "Reading NumRecBytes\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  543  	for (i = 0; i < 100; i++) {
c1986ee9bea3d8 Harald Welte 2005-11-13  544  		io_read_num_rec_bytes(iobase, &num_bytes_read);
c1986ee9bea3d8 Harald Welte 2005-11-13  545  		if (num_bytes_read >= 4) {
c1986ee9bea3d8 Harald Welte 2005-11-13  546  			DEBUGP(2, dev, "NumRecBytes = %i\n", num_bytes_read);
c1986ee9bea3d8 Harald Welte 2005-11-13  547  			break;
c1986ee9bea3d8 Harald Welte 2005-11-13  548  		}
be826ada52f1fc Jia-Ju Bai   2018-03-18  549  		usleep_range(10000, 11000);
c1986ee9bea3d8 Harald Welte 2005-11-13  550  	}
c1986ee9bea3d8 Harald Welte 2005-11-13  551  
c1986ee9bea3d8 Harald Welte 2005-11-13  552  	/* check whether it is a short PTS reply? */
c1986ee9bea3d8 Harald Welte 2005-11-13  553  	if (num_bytes_read == 3)
c1986ee9bea3d8 Harald Welte 2005-11-13  554  		i = 0;
c1986ee9bea3d8 Harald Welte 2005-11-13  555  
c1986ee9bea3d8 Harald Welte 2005-11-13  556  	if (i == 100) {
c1986ee9bea3d8 Harald Welte 2005-11-13  557  		DEBUGP(5, dev, "Timeout reading num_bytes_read\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  558  		rc = -EIO;
c1986ee9bea3d8 Harald Welte 2005-11-13  559  		goto exit_setprotocol;
c1986ee9bea3d8 Harald Welte 2005-11-13  560  	}
c1986ee9bea3d8 Harald Welte 2005-11-13  561  
c1986ee9bea3d8 Harald Welte 2005-11-13  562  	DEBUGP(5, dev, "Reset the CARDMAN CONTROLLER\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  563  	xoutb(0x80, REG_FLAGS0(iobase));
c1986ee9bea3d8 Harald Welte 2005-11-13  564  
c1986ee9bea3d8 Harald Welte 2005-11-13  565  	/* Read PPS reply */
c1986ee9bea3d8 Harald Welte 2005-11-13  566  	DEBUGP(5, dev, "Read PPS reply\n");
c1986ee9bea3d8 Harald Welte 2005-11-13  567  	for (i = 0; i < num_bytes_read; i++) {
c1986ee9bea3d8 Harald Welte 2005-11-13  568  		xoutb(i, REG_BUF_ADDR(iobase));
c1986ee9bea3d8 Harald Welte 2005-11-13 @569  		pts_reply[i] = inb(REG_BUF_DATA(iobase));
c1986ee9bea3d8 Harald Welte 2005-11-13  570  	}
c1986ee9bea3d8 Harald Welte 2005-11-13  571  

:::::: The code at line 569 was first introduced by commit
:::::: c1986ee9bea3d880bcf0d3f1a31e055778f306c7 [PATCH] New Omnikey Cardman 4000 driver

:::::: TO: Harald Welte <laforge@gnumonks.org>
:::::: CC: Linus Torvalds <torvalds@g5.osdl.org>

---
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: 28173 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-13  8:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13  8:52 [linux-next:master 1527/2770] drivers/char/pcmcia/cm4000_cs.c:569:16: warning: iteration 4 invokes undefined behavior 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).