All of lore.kernel.org
 help / color / mirror / Atom feed
* [zen-kernel-zen-kernel:5.13/zen-sauce 3/23] drivers/i2c/busses/i2c-nct6775.c:221:18: warning: this statement may fall through
@ 2021-07-23  5:38 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-07-23  5:38 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://github.com/zen-kernel/zen-kernel 5.13/zen-sauce
head:   732e5405c0311f1e32e6e4b0cd30fc104209e6bd
commit: 74e3df8f6e24c8c473b326a1d750de7d8b77b177 [3/23] ZEN: Add OpenRGB patches
config: nios2-randconfig-r034-20210719 (attached as .config)
compiler: nios2-linux-gcc (GCC) 10.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://github.com/zen-kernel/zen-kernel/commit/74e3df8f6e24c8c473b326a1d750de7d8b77b177
        git remote add zen-kernel-zen-kernel https://github.com/zen-kernel/zen-kernel
        git fetch --no-tags zen-kernel-zen-kernel 5.13/zen-sauce
        git checkout 74e3df8f6e24c8c473b326a1d750de7d8b77b177
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=nios2 

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/i2c/busses/i2c-nct6775.c: In function 'nct6775_access':
>> drivers/i2c/busses/i2c-nct6775.c:221:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     221 |    tmp_data.byte = data->byte;
         |    ~~~~~~~~~~~~~~^~~~~~~~~~~~
   drivers/i2c/busses/i2c-nct6775.c:222:3: note: here
     222 |   case I2C_SMBUS_BYTE:
         |   ^~~~
   At top level:
   drivers/i2c/busses/i2c-nct6775.c:93:27: warning: 'nct6775_device_names' defined but not used [-Wunused-const-variable=]
      93 | static const char * const nct6775_device_names[] = {
         |                           ^~~~~~~~~~~~~~~~~~~~


vim +221 drivers/i2c/busses/i2c-nct6775.c

   197	
   198	/* Return negative errno on error. */
   199	static s32 nct6775_access(struct i2c_adapter * adap, u16 addr,
   200			 unsigned short flags, char read_write,
   201			 u8 command, int size, union i2c_smbus_data * data)
   202	{
   203		struct i2c_nct6775_adapdata *adapdata = i2c_get_adapdata(adap);
   204		unsigned short nuvoton_nct6793d_smba = adapdata->smba;
   205		int i, len, cnt;
   206		union i2c_smbus_data tmp_data;
   207		int timeout = 0;
   208	
   209		tmp_data.word = 0;
   210		cnt = 0;
   211		len = 0;
   212	
   213		outb_p(NCT6793D_SOFT_RESET, SMBHSTCTL);
   214	
   215		switch (size) {
   216			case I2C_SMBUS_QUICK:
   217				outb_p((addr << 1) | read_write,
   218				       SMBHSTADD);
   219				break;
   220			case I2C_SMBUS_BYTE_DATA:
 > 221				tmp_data.byte = data->byte;
   222			case I2C_SMBUS_BYTE:
   223				outb_p((addr << 1) | read_write,
   224				       SMBHSTADD);
   225				outb_p(command, SMBHSTIDX);
   226				if (read_write == I2C_SMBUS_WRITE) {
   227					outb_p(tmp_data.byte, SMBHSTDAT);
   228					outb_p(NCT6793D_WRITE_BYTE, SMBHSTCMD);
   229				}
   230				else {
   231					outb_p(NCT6793D_READ_BYTE, SMBHSTCMD);
   232				}
   233				break;
   234			case I2C_SMBUS_WORD_DATA:
   235				outb_p((addr << 1) | read_write,
   236				       SMBHSTADD);
   237				outb_p(command, SMBHSTIDX);
   238				if (read_write == I2C_SMBUS_WRITE) {
   239					outb_p(data->word & 0xff, SMBHSTDAT);
   240					outb_p((data->word & 0xff00) >> 8, SMBHSTDAT);
   241					outb_p(NCT6793D_WRITE_WORD, SMBHSTCMD);
   242				}
   243				else {
   244					outb_p(NCT6793D_READ_WORD, SMBHSTCMD);
   245				}
   246				break;
   247			case I2C_SMBUS_BLOCK_DATA:
   248				outb_p((addr << 1) | read_write,
   249				       SMBHSTADD);
   250				outb_p(command, SMBHSTIDX);
   251				if (read_write == I2C_SMBUS_WRITE) {
   252					len = data->block[0];
   253					if (len == 0 || len > I2C_SMBUS_BLOCK_MAX)
   254						return -EINVAL;
   255					outb_p(len, SMBBLKSZ);
   256	
   257					cnt = 1;
   258					if (len >= 4) {
   259						for (i = cnt; i <= 4; i++) {
   260							outb_p(data->block[i], SMBHSTDAT);
   261						}
   262	
   263						len -= 4;
   264						cnt += 4;
   265					}
   266					else {
   267						for (i = cnt; i <= len; i++ ) {
   268							outb_p(data->block[i], SMBHSTDAT);
   269						}
   270	
   271						len = 0;
   272					}
   273	
   274					outb_p(NCT6793D_WRITE_BLOCK, SMBHSTCMD);
   275				}
   276				else {
   277					return -ENOTSUPP;
   278				}
   279				break;
   280			default:
   281				dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
   282				return -EOPNOTSUPP;
   283		}
   284	
   285		outb_p(NCT6793D_MANUAL_START, SMBHSTCTL);
   286	
   287		while ((size == I2C_SMBUS_BLOCK_DATA) && (len > 0)) {
   288			if (read_write == I2C_SMBUS_WRITE) {
   289				timeout = 0;
   290				while ((inb_p(SMBHSTSTS) & NCT6793D_FIFO_EMPTY) == 0)
   291				{
   292					if(timeout > MAX_RETRIES)
   293					{
   294						return -ETIMEDOUT;
   295					}
   296					usleep_range(250, 500);
   297					timeout++;
   298				}
   299	
   300				//Load more bytes into FIFO
   301				if (len >= 4) {
   302					for (i = cnt; i <= (cnt + 4); i++) {
   303						outb_p(data->block[i], SMBHSTDAT);
   304					}
   305	
   306					len -= 4;
   307					cnt += 4;
   308				}
   309				else {
   310					for (i = cnt; i <= (cnt + len); i++) {
   311						outb_p(data->block[i], SMBHSTDAT);
   312					}
   313	
   314					len = 0;
   315				}
   316			}
   317			else {
   318				return -ENOTSUPP;
   319			}
   320			
   321		}
   322	
   323		//wait for manual mode to complete
   324		timeout = 0;
   325		while ((inb_p(SMBHSTSTS) & NCT6793D_MANUAL_ACTIVE) != 0)
   326		{
   327			if(timeout > MAX_RETRIES)
   328			{
   329				return -ETIMEDOUT;
   330			}
   331			usleep_range(250, 500);
   332			timeout++;
   333		}
   334	
   335		if ((inb_p(SMBHSTERR) & NCT6793D_NO_ACK) != 0) {    	
   336			return -ENXIO;
   337		}
   338		else if ((read_write == I2C_SMBUS_WRITE) || (size == I2C_SMBUS_QUICK)) {
   339			return 0;
   340		}
   341	
   342		switch (size) {
   343			case I2C_SMBUS_QUICK:
   344			case I2C_SMBUS_BYTE_DATA:
   345				data->byte = inb_p(SMBHSTDAT);
   346				break;
   347			case I2C_SMBUS_WORD_DATA:
   348				data->word = inb_p(SMBHSTDAT) + (inb_p(SMBHSTDAT) << 8);
   349				break;
   350		}
   351		return 0;
   352	}
   353	

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

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

only message in thread, other threads:[~2021-07-23  5:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23  5:38 [zen-kernel-zen-kernel:5.13/zen-sauce 3/23] drivers/i2c/busses/i2c-nct6775.c:221:18: warning: this statement may fall through kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.