Re: [PATCH 3/5] i2c: piix4: Add ACPI support for ASF SMBus device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shyam,

kernel test robot noticed the following build warnings:

[auto build test WARNING on andi-shyti/i2c/i2c-host]
[also build test WARNING on linus/master v6.11-rc5 next-20240823]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shyam-Sundar-S-K/i2c-piix4-Allow-more-than-two-algo-selection-for-SMBus/20240826-113028
base:   https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20240822142200.686842-4-Shyam-sundar.S-k%40amd.com
patch subject: [PATCH 3/5] i2c: piix4: Add ACPI support for ASF SMBus device
config: i386-buildonly-randconfig-003-20240826 (https://download.01.org/0day-ci/archive/20240826/202408261816.iYeJHXHU-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240826/202408261816.iYeJHXHU-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408261816.iYeJHXHU-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/i2c/busses/i2c-piix4.c:935:6: warning: variable 'cmd' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     935 |         if (!(reg & SB800_ASF_ERROR_STATUS)) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/busses/i2c-piix4.c:971:8: note: uninitialized use occurs here
     971 |         if (!(cmd & BIT(0))) {
         |               ^~~
   drivers/i2c/busses/i2c-piix4.c:935:2: note: remove the 'if' if its condition is always true
     935 |         if (!(reg & SB800_ASF_ERROR_STATUS)) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/busses/i2c-piix4.c:927:19: note: initialize the variable 'cmd' to silence this warning
     927 |         u8 bank, reg, cmd;
         |                          ^
         |                           = '\0'
   1 warning generated.


vim +935 drivers/i2c/busses/i2c-piix4.c

   920	
   921	static void sb800_asf_process_slave(struct work_struct *work)
   922	{
   923		struct i2c_piix4_adapdata *adapdata = container_of(work, struct i2c_piix4_adapdata,
   924								   work_buf.work);
   925		unsigned short piix4_smba = adapdata->smba;
   926		u8 data[SB800_ASF_BLOCK_MAX_BYTES];
   927		u8 bank, reg, cmd;
   928		u8 len, val = 0;
   929		int i;
   930	
   931		/* Read slave status register */
   932		reg = inb_p(ASFSLVSTA);
   933	
   934		/* Check if no error bits are set in slave status register */
 > 935		if (!(reg & SB800_ASF_ERROR_STATUS)) {
   936			/* Read data bank */
   937			reg = inb_p(ASFDATABNKSEL);
   938			bank = (reg & BIT(3)) >> 3;
   939	
   940			/* Set read data bank */
   941			if (bank) {
   942				reg = reg | BIT(4);
   943				reg = reg & (~BIT(3));
   944			} else {
   945				reg = reg & (~BIT(4));
   946				reg = reg & (~BIT(2));
   947			}
   948	
   949			/* Read command register */
   950			outb_p(reg, ASFDATABNKSEL);
   951			cmd = inb_p(ASFINDEX);
   952			len = inb_p(ASFDATARWPTR);
   953			for (i = 0; i < len; i++)
   954				data[i] = inb_p(ASFINDEX);
   955	
   956			/* Clear data bank status */
   957			if (bank) {
   958				reg = reg | BIT(3);
   959				outb_p(reg, ASFDATABNKSEL);
   960			} else {
   961				reg = reg | BIT(2);
   962				outb_p(reg, ASFDATABNKSEL);
   963			}
   964		} else {
   965			/* Set bank as full */
   966			reg = reg | (BIT(3) | BIT(2));
   967			outb_p(reg, ASFDATABNKSEL);
   968		}
   969	
   970		outb_p(0, ASFSETDATARDPTR);
   971		if (!(cmd & BIT(0))) {
   972			i2c_slave_event(adapdata->slave, I2C_SLAVE_WRITE_REQUESTED, &val);
   973			for (i = 0; i < len; i++) {
   974				val = data[i];
   975				i2c_slave_event(adapdata->slave, I2C_SLAVE_WRITE_RECEIVED, &val);
   976			}
   977			i2c_slave_event(adapdata->slave, I2C_SLAVE_STOP, &val);
   978		}
   979	}
   980	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux