Subject: Re: [PATCH net-next] net: sfp: VSOL V2801F / CarlitoxxPro CPGOS03-0490 v2.0 workaround

From: kernel test robot <[email-masked]>
Date: Tue, 24 Nov 2020 08:18:56 +0800

Hi Russell,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Russell-King/net-sfp-VSOL-V2801F-CarlitoxxPro-CPGOS03-0490-v2-0-workaround/20201124-055921
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 8e1e33ffa696b2d779dd5cd422a80960b88e508c
config: arc-randconfig-r016-20201123 (attached as .config)
compiler: arc-elf-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://github.com/0day-ci/linux/commit/90849b26224de3b2e508f1c3fa31665f4fd72d0a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Russell-King/net-sfp-VSOL-V2801F-CarlitoxxPro-CPGOS03-0490-v2-0-workaround/20201124-055921
        git checkout 90849b26224de3b2e508f1c3fa31665f4fd72d0a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All warnings (new ones prefixed by >>):

   drivers/net/phy/sfp.c: In function 'sfp_i2c_read':
>> drivers/net/phy/sfp.c:339:9: warning: variable 'block_size' set but not used [-Wunused-but-set-variable]
     339 |  size_t block_size;
         |         ^~~~~~~~~~

vim +/block_size +339 drivers/net/phy/sfp.c

   334	
   335	static int sfp_i2c_read(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
   336				size_t len)
   337	{
   338		struct i2c_msg msgs[2];
 > 339		size_t block_size;
   340		size_t this_len;
   341		u8 bus_addr;
   342		int ret;
   343	
   344		if (a2) {
   345			block_size = 16;
   346			bus_addr = 0x51;
   347		} else {
   348			block_size = sfp->i2c_block_size;
   349			bus_addr = 0x50;
   350		}
   351	
   352		msgs[0].addr = bus_addr;
   353		msgs[0].flags = 0;
   354		msgs[0].len = 1;
   355		msgs[0].buf = &dev_addr;
   356		msgs[1].addr = bus_addr;
   357		msgs[1].flags = I2C_M_RD;
   358		msgs[1].len = len;
   359		msgs[1].buf = buf;
   360	
   361		while (len) {
   362			this_len = len;
   363			if (this_len > sfp->i2c_block_size)
   364				this_len = sfp->i2c_block_size;
   365	
   366			msgs[1].len = this_len;
   367	
   368			ret = i2c_transfer(sfp->i2c, msgs, ARRAY_SIZE(msgs));
   369			if (ret < 0)
   370				return ret;
   371	
   372			if (ret != ARRAY_SIZE(msgs))
   373				break;
   374	
   375			msgs[1].buf += this_len;
   376			dev_addr += this_len;
   377			len -= this_len;
   378		}
   379	
   380		return msgs[1].buf - (u8 *)buf;
   381	}
   382	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]