drivers/usb/typec/tcpm/wcove.c:380:50: sparse: sparse: incorrect type in argument 1 (different base types)

From: kernel test robot
Date: Thu Nov 12 2020 - 22:21:21 EST


Hi Mika,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 585e5b17b92dead8a3aca4e3c9876fbca5f7e0ba
commit: 25f1ca31e230598eaf3c38d387a355a64bd772a7 platform/x86: intel_pmc_ipc: Convert to MFD
date: 7 months ago
config: x86_64-randconfig-s022-20201113 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-107-gaf3512a6-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=25f1ca31e230598eaf3c38d387a355a64bd772a7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 25f1ca31e230598eaf3c38d387a355a64bd772a7
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


"sparse warnings: (new ones prefixed by >>)"
>> drivers/usb/typec/tcpm/wcove.c:380:50: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] header @@ got restricted __le16 const [usertype] header @@
>> drivers/usb/typec/tcpm/wcove.c:380:50: sparse: expected unsigned short [usertype] header
>> drivers/usb/typec/tcpm/wcove.c:380:50: sparse: got restricted __le16 const [usertype] header

vim +380 drivers/usb/typec/tcpm/wcove.c

3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 356
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 357 static int wcove_pd_transmit(struct tcpc_dev *tcpc,
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 358 enum tcpm_transmit_type type,
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 359 const struct pd_message *msg)
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 360 {
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 361 struct wcove_typec *wcove = tcpc_to_wcove(tcpc);
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 362 unsigned int info = 0;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 363 unsigned int cmd;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 364 int ret;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 365
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 366 ret = regmap_read(wcove->regmap, USBC_TXCMD, &cmd);
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 367 if (ret)
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 368 return ret;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 369
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 370 if (!(cmd & USBC_TXCMD_BUF_RDY)) {
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 371 dev_warn(wcove->dev, "%s: Last transmission still ongoing!",
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 372 __func__);
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 373 return -EBUSY;
d2061f9cc32dbb8 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-03-21 374 }
d2061f9cc32dbb8 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-03-21 375
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 376 if (msg) {
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 377 const u8 *data = (void *)msg;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 378 int i;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 379
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 @380 for (i = 0; i < pd_header_cnt(msg->header) * 4 + 2; i++) {
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 381 ret = regmap_write(wcove->regmap, USBC_TX_DATA + i,
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 382 data[i]);
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 383 if (ret)
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 384 return ret;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 385 }
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 386 }
d2061f9cc32dbb8 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-03-21 387
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 388 switch (type) {
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 389 case TCPC_TX_SOP:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 390 case TCPC_TX_SOP_PRIME:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 391 case TCPC_TX_SOP_PRIME_PRIME:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 392 case TCPC_TX_SOP_DEBUG_PRIME:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 393 case TCPC_TX_SOP_DEBUG_PRIME_PRIME:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 394 info = type + 1;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 395 cmd = USBC_TXCMD_MSG;
d2061f9cc32dbb8 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-03-21 396 break;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 397 case TCPC_TX_HARD_RESET:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 398 cmd = USBC_TXCMD_HR;
d2061f9cc32dbb8 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-03-21 399 break;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 400 case TCPC_TX_CABLE_RESET:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 401 cmd = USBC_TXCMD_CR;
d2061f9cc32dbb8 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-03-21 402 break;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 403 case TCPC_TX_BIST_MODE_2:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 404 cmd = USBC_TXCMD_BIST;
d2061f9cc32dbb8 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-03-21 405 break;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 406 default:
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 407 return -EINVAL;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 408 }
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 409
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 410 /* NOTE Setting maximum number of retries (7) */
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 411 ret = regmap_write(wcove->regmap, USBC_TXINFO,
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 412 info | USBC_TXINFO_RETRIES(7));
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 413 if (ret)
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 414 return ret;
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 415
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 416 return regmap_write(wcove->regmap, USBC_TXCMD, cmd | USBC_TXCMD_START);
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 417 }
3c4fb9f16921429 drivers/usb/typec/typec_wcove.c Heikki Krogerus 2017-09-20 418

:::::: The code at line 380 was first introduced by commit
:::::: 3c4fb9f169214290ec9a943907321e6265b36f65 usb: typec: wcove: start using tcpm for USB PD support

:::::: TO: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip