All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Conor Dooley <conor@kernel.org>, linux-i2c@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	conor@kernel.org, Conor Dooley <conor.dooley@microchip.com>,
	Daire McNamara <daire.mcnamara@microchip.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] i2c: microchip-core: re-fix fake detections w/ i2cdetect
Date: Sat, 28 Jun 2025 22:28:45 +0800	[thread overview]
Message-ID: <202506282209.FXWbPIPz-lkp@intel.com> (raw)
In-Reply-To: <20250626-unusable-excess-da94ebc218e8@spud>

Hi Conor,

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.16-rc3 next-20250627]
[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/Conor-Dooley/i2c-microchip-core-re-fix-fake-detections-w-i2cdetect/20250627-001626
base:   https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20250626-unusable-excess-da94ebc218e8%40spud
patch subject: [PATCH v2] i2c: microchip-core: re-fix fake detections w/ i2cdetect
config: riscv-randconfig-002-20250628 (https://download.01.org/0day-ci/archive/20250628/202506282209.FXWbPIPz-lkp@intel.com/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250628/202506282209.FXWbPIPz-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506282209.FXWbPIPz-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/i2c/busses/i2c-microchip-corei2c.c:510:6: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
           if (ret < 0)
               ^~~
   drivers/i2c/busses/i2c-microchip-corei2c.c:438:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +/ret +510 drivers/i2c/busses/i2c-microchip-corei2c.c

   428	
   429	static int mchp_corei2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags,
   430					   char read_write, u8 command,
   431					   int size, union i2c_smbus_data *data)
   432	{
   433		struct i2c_msg msgs[2];
   434		struct mchp_corei2c_dev *idev = i2c_get_adapdata(adap);
   435		u8 tx_buf[I2C_SMBUS_BLOCK_MAX + 2];
   436		u8 rx_buf[I2C_SMBUS_BLOCK_MAX + 1];
   437		int num_msgs = 1;
   438		int ret;
   439	
   440		msgs[CORE_I2C_SMBUS_MSG_WR].addr = addr;
   441		msgs[CORE_I2C_SMBUS_MSG_WR].flags = 0;
   442	
   443		if (read_write == I2C_SMBUS_READ && size <= I2C_SMBUS_BYTE)
   444			msgs[CORE_I2C_SMBUS_MSG_WR].flags = I2C_M_RD;
   445	
   446		if (read_write == I2C_SMBUS_WRITE && size <= I2C_SMBUS_WORD_DATA)
   447			msgs[CORE_I2C_SMBUS_MSG_WR].len = size;
   448	
   449		if (read_write == I2C_SMBUS_WRITE && size > I2C_SMBUS_BYTE) {
   450			msgs[CORE_I2C_SMBUS_MSG_WR].buf = tx_buf;
   451			msgs[CORE_I2C_SMBUS_MSG_WR].buf[0] = command;
   452		}
   453	
   454		if (read_write == I2C_SMBUS_READ && size >= I2C_SMBUS_BYTE_DATA) {
   455			msgs[CORE_I2C_SMBUS_MSG_WR].buf = tx_buf;
   456			msgs[CORE_I2C_SMBUS_MSG_WR].buf[0] = command;
   457			msgs[CORE_I2C_SMBUS_MSG_RD].addr = addr;
   458			msgs[CORE_I2C_SMBUS_MSG_RD].flags = I2C_M_RD;
   459			num_msgs = 2;
   460		}
   461	
   462		if (read_write == I2C_SMBUS_READ && size > I2C_SMBUS_QUICK)
   463			msgs[CORE_I2C_SMBUS_MSG_WR].len = 1;
   464	
   465		switch (size) {
   466		case I2C_SMBUS_QUICK:
   467			msgs[CORE_I2C_SMBUS_MSG_WR].buf = NULL;
   468			return 0;
   469		case I2C_SMBUS_BYTE:
   470			if (read_write == I2C_SMBUS_WRITE)
   471				msgs[CORE_I2C_SMBUS_MSG_WR].buf = &command;
   472			else
   473				msgs[CORE_I2C_SMBUS_MSG_WR].buf = &data->byte;
   474			break;
   475		case I2C_SMBUS_BYTE_DATA:
   476			if (read_write == I2C_SMBUS_WRITE) {
   477				msgs[CORE_I2C_SMBUS_MSG_WR].buf[1] = data->byte;
   478			} else {
   479				msgs[CORE_I2C_SMBUS_MSG_RD].len = size - 1;
   480				msgs[CORE_I2C_SMBUS_MSG_RD].buf = &data->byte;
   481			}
   482			break;
   483		case I2C_SMBUS_WORD_DATA:
   484			if (read_write == I2C_SMBUS_WRITE) {
   485				msgs[CORE_I2C_SMBUS_MSG_WR].buf[1] = data->word & 0xFF;
   486				msgs[CORE_I2C_SMBUS_MSG_WR].buf[2] = (data->word >> 8) & 0xFF;
   487			} else {
   488				msgs[CORE_I2C_SMBUS_MSG_RD].len = size - 1;
   489				msgs[CORE_I2C_SMBUS_MSG_RD].buf = rx_buf;
   490			}
   491			break;
   492		case I2C_SMBUS_BLOCK_DATA:
   493			if (read_write == I2C_SMBUS_WRITE) {
   494				int data_len;
   495	
   496				data_len = data->block[0];
   497				msgs[CORE_I2C_SMBUS_MSG_WR].len = data_len + 2;
   498				for (int i = 0; i <= data_len; i++)
   499					msgs[CORE_I2C_SMBUS_MSG_WR].buf[i + 1] = data->block[i];
   500			} else {
   501				msgs[CORE_I2C_SMBUS_MSG_RD].len = I2C_SMBUS_BLOCK_MAX + 1;
   502				msgs[CORE_I2C_SMBUS_MSG_RD].buf = rx_buf;
   503			}
   504			break;
   505		default:
   506			return -EOPNOTSUPP;
   507		}
   508	
   509		mchp_corei2c_xfer(&idev->adapter, msgs, num_msgs);
 > 510		if (ret < 0)
   511			return ret;
   512	
   513		if (read_write == I2C_SMBUS_WRITE || size <= I2C_SMBUS_BYTE_DATA)
   514			return 0;
   515	
   516		switch (size) {
   517		case I2C_SMBUS_WORD_DATA:
   518			data->word = (rx_buf[0] | (rx_buf[1] << 8));
   519			break;
   520		case I2C_SMBUS_BLOCK_DATA:
   521			if (rx_buf[0] > I2C_SMBUS_BLOCK_MAX)
   522				rx_buf[0] = I2C_SMBUS_BLOCK_MAX;
   523			/* As per protocol first member of block is size of the block. */
   524			for (int i = 0; i <= rx_buf[0]; i++)
   525				data->block[i] = rx_buf[i];
   526			break;
   527		}
   528	
   529		return 0;
   530	}
   531	

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

  reply	other threads:[~2025-06-28 14:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26 16:15 [PATCH v2] i2c: microchip-core: re-fix fake detections w/ i2cdetect Conor Dooley
2025-06-28 14:28 ` kernel test robot [this message]
2025-06-30 15:04   ` Conor Dooley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202506282209.FXWbPIPz-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=conor@kernel.org \
    --cc=daire.mcnamara@microchip.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.