drivers/net/mdio/mdio-mux-mmioreg.c:91:25: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Mon Dec 14 2020 - 12:13:11 EST


Hi Andrew,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2c85ebc57b3e1817b6ce1a6b703928e113a90442
commit: a9770eac511ad82390b9f4a3c1728e078c387ac7 net: mdio: Move MDIO drivers into a new subdirectory
date: 4 months ago
config: openrisc-randconfig-s031-20201214 (attached as .config)
compiler: or1k-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-184-g1b896707-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a9770eac511ad82390b9f4a3c1728e078c387ac7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a9770eac511ad82390b9f4a3c1728e078c387ac7
# 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=openrisc

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/mdio/mdio-mux-mmioreg.c:91:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *p @@
drivers/net/mdio/mdio-mux-mmioreg.c:91:25: sparse: expected void *addr
drivers/net/mdio/mdio-mux-mmioreg.c:91:25: sparse: got void [noderef] __iomem *p

vim +91 drivers/net/mdio/mdio-mux-mmioreg.c

6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 24
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 25 /*
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 26 * MDIO multiplexing switch function
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 27 *
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 28 * This function is called by the mdio-mux layer when it thinks the mdio bus
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 29 * multiplexer needs to switch.
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 30 *
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 31 * 'current_child' is the current value of the mux register (masked via
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 32 * s->mask).
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 33 *
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 34 * 'desired_child' is the value of the 'reg' property of the target child MDIO
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 35 * node.
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 36 *
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 37 * The first time this function is called, current_child == -1.
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 38 *
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 39 * If current_child == desired_child, then the mux is already set to the
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 40 * correct bus.
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 41 */
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 42 static int mdio_mux_mmioreg_switch_fn(int current_child, int desired_child,
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 43 void *data)
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 44 {
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 45 struct mdio_mux_mmioreg_state *s = data;
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 46
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 47 if (current_child ^ desired_child) {
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 48 void __iomem *p = ioremap(s->phys, s->iosize);
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 49 if (!p)
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 50 return -ENOMEM;
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 51
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 52 switch (s->iosize) {
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 53 case sizeof(uint8_t): {
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 54 uint8_t x, y;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 55
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 56 x = ioread8(p);
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 57 y = (x & ~s->mask) | desired_child;
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 58 if (x != y) {
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 59 iowrite8((x & ~s->mask) | desired_child, p);
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 60 pr_debug("%s: %02x -> %02x\n", __func__, x, y);
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 61 }
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 62
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 63 break;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 64 }
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 65 case sizeof(uint16_t): {
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 66 uint16_t x, y;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 67
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 68 x = ioread16(p);
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 69 y = (x & ~s->mask) | desired_child;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 70 if (x != y) {
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 71 iowrite16((x & ~s->mask) | desired_child, p);
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 72 pr_debug("%s: %04x -> %04x\n", __func__, x, y);
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 73 }
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 74
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 75 break;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 76 }
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 77 case sizeof(uint32_t): {
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 78 uint32_t x, y;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 79
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 80 x = ioread32(p);
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 81 y = (x & ~s->mask) | desired_child;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 82 if (x != y) {
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 83 iowrite32((x & ~s->mask) | desired_child, p);
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 84 pr_debug("%s: %08x -> %08x\n", __func__, x, y);
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 85 }
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 86
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 87 break;
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 88 }
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 89 }
9a4c803748250f3 drivers/net/phy/mdio-mux-mmioreg.c Neil Armstrong 2016-11-04 90
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 @91 iounmap(p);
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 92 }
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 93
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 94 return 0;
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 95 }
6cc2ff82492d89f drivers/net/phy/mdio-mux-mmioreg.c Timur Tabi 2012-08-24 96

:::::: The code at line 91 was first introduced by commit
:::::: 6cc2ff82492d89f763e69ea6b8681926aceda610 netdev/phy: add MDIO bus multiplexer driven by a memory-mapped device

:::::: TO: Timur Tabi <timur@xxxxxxxxxxxxx>
:::::: 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