From: kernel test robot <lkp@intel.com>
To: Nishanth Sampath Kumar <nissampa@cisco.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Mark Brown <broonie@kernel.org>
Subject: drivers/base/regmap/regmap-i2c.c:340:42: sparse: sparse: incorrect type in argument 3 (different base types)
Date: Sat, 16 May 2026 16:17:25 +0800 [thread overview]
Message-ID: <202605161621.mY5zFh4D-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d458a240344c4369bf6f3da203f2779515177738
commit: bad4bd28abf4d7cb2adcb39cc0de789729d2cd69 regmap-i2c: add SMBus byte/word reg16 bus for adapters lacking I2C_FUNC_I2C
date: 5 weeks ago
config: x86_64-randconfig-122-20260516 (https://download.01.org/0day-ci/archive/20260516/202605161621.mY5zFh4D-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260516/202605161621.mY5zFh4D-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
| Fixes: bad4bd28abf4 ("regmap-i2c: add SMBus byte/word reg16 bus for adapters lacking I2C_FUNC_I2C")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605161621.mY5zFh4D-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/base/regmap/regmap-i2c.c:340:42: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned short [usertype] value @@ got restricted __le16 [usertype] @@
drivers/base/regmap/regmap-i2c.c:340:42: sparse: expected unsigned short [usertype] value
drivers/base/regmap/regmap-i2c.c:340:42: sparse: got restricted __le16 [usertype]
vim +340 drivers/base/regmap/regmap-i2c.c
305
306 /*
307 * SMBus byte/word reg16 support for adapters that have SMBUS_BYTE_DATA
308 * and SMBUS_WORD_DATA but lack I2C_FUNC_I2C and I2C_FUNC_SMBUS_I2C_BLOCK,
309 * such as the AMD PIIX4.
310 *
311 * READ: set 16-bit EEPROM address via write_byte_data(addr_lo, addr_hi),
312 * then sequentially read bytes via read_byte() (EEPROM auto-
313 * increments the address pointer). Same as the I2C-block reg16
314 * read path above.
315 *
316 * WRITE: encode the low address byte and data into a word transaction:
317 * write_word_data(addr_hi, (data_byte << 8) | addr_lo).
318 * Only single-byte writes are supported (one value per transaction).
319 */
320 static int regmap_smbus_word_write_reg16(void *context, const void *data,
321 size_t count)
322 {
323 struct device *dev = context;
324 struct i2c_client *i2c = to_i2c_client(dev);
325 u8 addr_hi, addr_lo, val;
326
327 /*
328 * data layout: [addr_hi, addr_lo, val0, val1, ...].
329 * Only single-byte value writes are supported; multi-byte would
330 * require raw I2C (or repeated word writes with incrementing address).
331 */
332 if (count != 3)
333 return -EINVAL;
334
335 addr_hi = ((u8 *)data)[0];
336 addr_lo = ((u8 *)data)[1];
337 val = ((u8 *)data)[2];
338
339 return i2c_smbus_write_word_data(i2c, addr_hi,
> 340 cpu_to_le16(((u16)val << 8) | addr_lo));
341 }
342
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2026-05-16 8:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-16 8:17 kernel test robot [this message]
2026-05-19 16:52 ` [PATCH] regmap-i2c: fix sparse warning in regmap_smbus_word_write_reg16 Nishanth Sampath Kumar
2026-05-19 16:56 ` Mark Brown
2026-05-19 17:08 ` Nishanth Sampath Kumar
2026-05-19 21:43 ` kernel test robot
2026-05-19 22:16 ` kernel test robot
2026-05-19 22:05 ` [PATCH v2] " Nishanth Sampath Kumar
2026-05-20 9:31 ` Mark Brown
2026-05-20 11:58 ` Mark Brown
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=202605161621.mY5zFh4D-lkp@intel.com \
--to=lkp@intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nissampa@cisco.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox