drivers/net/wan/fsl_ucc_hdlc.c:458:33: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Mon Feb 01 2021 - 11:25:40 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1048ba83fb1c00cd24172e23e8263972f6b5d9ac
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date: 6 months ago
config: sh-randconfig-s031-20210201 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-215-g0fb77bb6-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh

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/net/wan/fsl_ucc_hdlc.c:305:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse: expected void [noderef] __iomem *
drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse: got restricted __be16 *
drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse: expected void [noderef] __iomem *
drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse: got restricted __be32 *
drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse: expected void [noderef] __iomem *
drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse: got restricted __be16 *
drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse: expected void [noderef] __iomem *
drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse: got restricted __be32 *
drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __be16 [usertype] @@
drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: expected unsigned short [usertype]
drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: got restricted __be16 [usertype]
drivers/net/wan/fsl_ucc_hdlc.c:375:36: sparse: sparse: restricted __be16 degrades to integer
drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qe_bd [noderef] __iomem *bd @@ got struct qe_bd *curtx_bd @@
drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse: expected struct qe_bd [noderef] __iomem *bd
drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse: got struct qe_bd *curtx_bd
drivers/net/wan/fsl_ucc_hdlc.c:408:35: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qe_bd [noderef] __iomem *[assigned] bd @@ got struct qe_bd *tx_bd_base @@
drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse: expected struct qe_bd [noderef] __iomem *[assigned] bd
drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse: got struct qe_bd *tx_bd_base
drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse: struct qe_bd [noderef] __iomem *
drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse: struct qe_bd *
>> drivers/net/wan/fsl_ucc_hdlc.c:458:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:502:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:524:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:548:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:592:67: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:607:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:408:35: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:408:35: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:723:29: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:814:21: sparse: sparse: dereference of noderef expression

vim +458 drivers/net/wan/fsl_ucc_hdlc.c

ba59d5705825fb Mathias Thore 2018-10-22 446
c19b6d246a3562 Zhao Qiang 2016-06-06 447 static int hdlc_tx_done(struct ucc_hdlc_private *priv)
c19b6d246a3562 Zhao Qiang 2016-06-06 448 {
c19b6d246a3562 Zhao Qiang 2016-06-06 449 /* Start from the next BD that should be filled */
c19b6d246a3562 Zhao Qiang 2016-06-06 450 struct net_device *dev = priv->ndev;
2e7ad56aa54778 Mathias Thore 2018-11-07 451 unsigned int bytes_sent = 0;
2e7ad56aa54778 Mathias Thore 2018-11-07 452 int howmany = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 453 struct qe_bd *bd; /* BD pointer */
c19b6d246a3562 Zhao Qiang 2016-06-06 454 u16 bd_status;
ba59d5705825fb Mathias Thore 2018-10-22 455 int tx_restart = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 456
c19b6d246a3562 Zhao Qiang 2016-06-06 457 bd = priv->dirty_tx;
c19b6d246a3562 Zhao Qiang 2016-06-06 @458 bd_status = ioread16be(&bd->status);
c19b6d246a3562 Zhao Qiang 2016-06-06 459
c19b6d246a3562 Zhao Qiang 2016-06-06 460 /* Normal processing. */
c19b6d246a3562 Zhao Qiang 2016-06-06 461 while ((bd_status & T_R_S) == 0) {
c19b6d246a3562 Zhao Qiang 2016-06-06 462 struct sk_buff *skb;
c19b6d246a3562 Zhao Qiang 2016-06-06 463
ba59d5705825fb Mathias Thore 2018-10-22 464 if (bd_status & T_UN_S) { /* Underrun */
ba59d5705825fb Mathias Thore 2018-10-22 465 dev->stats.tx_fifo_errors++;
ba59d5705825fb Mathias Thore 2018-10-22 466 tx_restart = 1;
ba59d5705825fb Mathias Thore 2018-10-22 467 }
ba59d5705825fb Mathias Thore 2018-10-22 468 if (bd_status & T_CT_S) { /* Carrier lost */
ba59d5705825fb Mathias Thore 2018-10-22 469 dev->stats.tx_carrier_errors++;
ba59d5705825fb Mathias Thore 2018-10-22 470 tx_restart = 1;
ba59d5705825fb Mathias Thore 2018-10-22 471 }
ba59d5705825fb Mathias Thore 2018-10-22 472
c19b6d246a3562 Zhao Qiang 2016-06-06 473 /* BD contains already transmitted buffer. */
c19b6d246a3562 Zhao Qiang 2016-06-06 474 /* Handle the transmitted buffer and release */
c19b6d246a3562 Zhao Qiang 2016-06-06 475 /* the BD to be used with the current frame */
c19b6d246a3562 Zhao Qiang 2016-06-06 476
c19b6d246a3562 Zhao Qiang 2016-06-06 477 skb = priv->tx_skbuff[priv->skb_dirtytx];
c19b6d246a3562 Zhao Qiang 2016-06-06 478 if (!skb)
c19b6d246a3562 Zhao Qiang 2016-06-06 479 break;
2e7ad56aa54778 Mathias Thore 2018-11-07 480 howmany++;
2e7ad56aa54778 Mathias Thore 2018-11-07 481 bytes_sent += skb->len;
c19b6d246a3562 Zhao Qiang 2016-06-06 482 dev->stats.tx_packets++;
c19b6d246a3562 Zhao Qiang 2016-06-06 483 memset(priv->tx_buffer +
c19b6d246a3562 Zhao Qiang 2016-06-06 484 (be32_to_cpu(bd->buf) - priv->dma_tx_addr),
c19b6d246a3562 Zhao Qiang 2016-06-06 485 0, skb->len);
7c3850adbcccc2 Yang Wei 2019-02-06 486 dev_consume_skb_irq(skb);
c19b6d246a3562 Zhao Qiang 2016-06-06 487
c19b6d246a3562 Zhao Qiang 2016-06-06 488 priv->tx_skbuff[priv->skb_dirtytx] = NULL;
c19b6d246a3562 Zhao Qiang 2016-06-06 489 priv->skb_dirtytx =
c19b6d246a3562 Zhao Qiang 2016-06-06 490 (priv->skb_dirtytx +
c19b6d246a3562 Zhao Qiang 2016-06-06 491 1) & TX_RING_MOD_MASK(TX_BD_RING_LEN);
c19b6d246a3562 Zhao Qiang 2016-06-06 492
c19b6d246a3562 Zhao Qiang 2016-06-06 493 /* We freed a buffer, so now we can restart transmission */
c19b6d246a3562 Zhao Qiang 2016-06-06 494 if (netif_queue_stopped(dev))
c19b6d246a3562 Zhao Qiang 2016-06-06 495 netif_wake_queue(dev);
c19b6d246a3562 Zhao Qiang 2016-06-06 496
c19b6d246a3562 Zhao Qiang 2016-06-06 497 /* Advance the confirmation BD pointer */
c19b6d246a3562 Zhao Qiang 2016-06-06 498 if (!(bd_status & T_W_S))
c19b6d246a3562 Zhao Qiang 2016-06-06 499 bd += 1;
c19b6d246a3562 Zhao Qiang 2016-06-06 500 else
c19b6d246a3562 Zhao Qiang 2016-06-06 501 bd = priv->tx_bd_base;
c19b6d246a3562 Zhao Qiang 2016-06-06 502 bd_status = ioread16be(&bd->status);
c19b6d246a3562 Zhao Qiang 2016-06-06 503 }
c19b6d246a3562 Zhao Qiang 2016-06-06 504 priv->dirty_tx = bd;
c19b6d246a3562 Zhao Qiang 2016-06-06 505
ba59d5705825fb Mathias Thore 2018-10-22 506 if (tx_restart)
ba59d5705825fb Mathias Thore 2018-10-22 507 hdlc_tx_restart(priv);
ba59d5705825fb Mathias Thore 2018-10-22 508
2e7ad56aa54778 Mathias Thore 2018-11-07 509 netdev_completed_queue(dev, howmany, bytes_sent);
c19b6d246a3562 Zhao Qiang 2016-06-06 510 return 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 511 }
c19b6d246a3562 Zhao Qiang 2016-06-06 512

:::::: The code at line 458 was first introduced by commit
:::::: c19b6d246a35627c3a69b2fa6bdece212b48214b drivers/net: support hdlc function for QE-UCC

:::::: TO: Zhao Qiang <qiang.zhao@xxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip