drivers/net/phy/mdio-octeon.c:48:3: warning: cast from pointer to integer of different size

From: kernel test robot
Date: Mon Jul 06 2020 - 12:30:40 EST


Hi Matthew,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dcb7fd82c75ee2d6e6f9d8cc71c52519ed52e258
commit: 171a9bae68c72f2d1260c3825203760856e6793b staging/octeon: Allow test build on !MIPS
date: 11 months ago
config: m68k-randconfig-r015-20200706 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 171a9bae68c72f2d1260c3825203760856e6793b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

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

All warnings (new ones prefixed by >>):

In file included from include/linux/ioport.h:13,
from include/linux/device.h:15,
from include/linux/platform_device.h:13,
from drivers/net/phy/mdio-octeon.c:6:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_no.h:33:50: warning: ordered comparison of pointer with null pointer [-Wextra]
33 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
drivers/net/phy/mdio-octeon.c: In function 'octeon_mdiobus_probe':
>> drivers/net/phy/mdio-octeon.c:48:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
48 | (u64)devm_ioremap(&pdev->dev, mdio_phys, regsize);
| ^
In file included from drivers/net/phy/mdio-octeon.c:14:
drivers/net/phy/mdio-cavium.h:111:36: error: implicit declaration of function 'writeq'; did you mean 'writel'? [-Werror=implicit-function-declaration]
111 | #define oct_mdio_writeq(val, addr) writeq(val, (void *)addr)
| ^~~~~~
>> drivers/net/phy/mdio-octeon.c:56:2: note: in expansion of macro 'oct_mdio_writeq'
56 | oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
| ^~~~~~~~~~~~~~~
>> drivers/net/phy/mdio-cavium.h:111:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
111 | #define oct_mdio_writeq(val, addr) writeq(val, (void *)addr)
| ^
>> drivers/net/phy/mdio-octeon.c:56:2: note: in expansion of macro 'oct_mdio_writeq'
56 | oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
| ^~~~~~~~~~~~~~~
>> drivers/net/phy/mdio-cavium.h:111:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
111 | #define oct_mdio_writeq(val, addr) writeq(val, (void *)addr)
| ^
drivers/net/phy/mdio-octeon.c:77:2: note: in expansion of macro 'oct_mdio_writeq'
77 | oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
| ^~~~~~~~~~~~~~~
drivers/net/phy/mdio-octeon.c: In function 'octeon_mdiobus_remove':
>> drivers/net/phy/mdio-cavium.h:111:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
111 | #define oct_mdio_writeq(val, addr) writeq(val, (void *)addr)
| ^
drivers/net/phy/mdio-octeon.c:91:2: note: in expansion of macro 'oct_mdio_writeq'
91 | oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
| ^~~~~~~~~~~~~~~
drivers/net/phy/mdio-octeon.c: At top level:
drivers/net/phy/mdio-octeon.c:112:6: warning: no previous prototype for 'octeon_mdiobus_force_mod_depencency' [-Wmissing-prototypes]
112 | void octeon_mdiobus_force_mod_depencency(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +48 drivers/net/phy/mdio-octeon.c

25d967b72a92d7 David Daney 2009-10-14 15
633d1594974b33 Bill Pemberton 2012-12-03 16 static int octeon_mdiobus_probe(struct platform_device *pdev)
25d967b72a92d7 David Daney 2009-10-14 17 {
1eefee901fca02 David Daney 2016-03-11 18 struct cavium_mdiobus *bus;
35d2aeac9810ca Andrew Lunn 2016-01-06 19 struct mii_bus *mii_bus;
2fd46f47be0f96 David Daney 2012-07-05 20 struct resource *res_mem;
1eefee901fca02 David Daney 2016-03-11 21 resource_size_t mdio_phys;
1eefee901fca02 David Daney 2016-03-11 22 resource_size_t regsize;
6c17812d622a74 David Daney 2010-04-01 23 union cvmx_smix_en smi_en;
25d967b72a92d7 David Daney 2009-10-14 24 int err = -ENOENT;
25d967b72a92d7 David Daney 2009-10-14 25
35d2aeac9810ca Andrew Lunn 2016-01-06 26 mii_bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*bus));
35d2aeac9810ca Andrew Lunn 2016-01-06 27 if (!mii_bus)
25d967b72a92d7 David Daney 2009-10-14 28 return -ENOMEM;
25d967b72a92d7 David Daney 2009-10-14 29
2fd46f47be0f96 David Daney 2012-07-05 30 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2fd46f47be0f96 David Daney 2012-07-05 31 if (res_mem == NULL) {
2fd46f47be0f96 David Daney 2012-07-05 32 dev_err(&pdev->dev, "found no memory resource\n");
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 33 return -ENXIO;
2fd46f47be0f96 David Daney 2012-07-05 34 }
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 35
35d2aeac9810ca Andrew Lunn 2016-01-06 36 bus = mii_bus->priv;
35d2aeac9810ca Andrew Lunn 2016-01-06 37 bus->mii_bus = mii_bus;
1eefee901fca02 David Daney 2016-03-11 38 mdio_phys = res_mem->start;
1eefee901fca02 David Daney 2016-03-11 39 regsize = resource_size(res_mem);
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 40
1eefee901fca02 David Daney 2016-03-11 41 if (!devm_request_mem_region(&pdev->dev, mdio_phys, regsize,
2fd46f47be0f96 David Daney 2012-07-05 42 res_mem->name)) {
2fd46f47be0f96 David Daney 2012-07-05 43 dev_err(&pdev->dev, "request_mem_region failed\n");
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 44 return -ENXIO;
2fd46f47be0f96 David Daney 2012-07-05 45 }
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 46
2fd46f47be0f96 David Daney 2012-07-05 47 bus->register_base =
1eefee901fca02 David Daney 2016-03-11 @48 (u64)devm_ioremap(&pdev->dev, mdio_phys, regsize);
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 49 if (!bus->register_base) {
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 50 dev_err(&pdev->dev, "dev_ioremap failed\n");
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 51 return -ENOMEM;
de9e397e40f56b Radha Mohan Chintakuntla 2015-07-28 52 }
25d967b72a92d7 David Daney 2009-10-14 53
6c17812d622a74 David Daney 2010-04-01 54 smi_en.u64 = 0;
6c17812d622a74 David Daney 2010-04-01 55 smi_en.s.en = 1;
a6d678645210f1 Radha Mohan Chintakuntla 2015-07-28 @56 oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
25d967b72a92d7 David Daney 2009-10-14 57
1eefee901fca02 David Daney 2016-03-11 58 bus->mii_bus->name = KBUILD_MODNAME;
2fd46f47be0f96 David Daney 2012-07-05 59 snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%llx", bus->register_base);
25d967b72a92d7 David Daney 2009-10-14 60 bus->mii_bus->parent = &pdev->dev;
25d967b72a92d7 David Daney 2009-10-14 61
1eefee901fca02 David Daney 2016-03-11 62 bus->mii_bus->read = cavium_mdiobus_read;
1eefee901fca02 David Daney 2016-03-11 63 bus->mii_bus->write = cavium_mdiobus_write;
25d967b72a92d7 David Daney 2009-10-14 64
f8825669b3165b Libo Chen 2013-08-21 65 platform_set_drvdata(pdev, bus);
25d967b72a92d7 David Daney 2009-10-14 66
2fd46f47be0f96 David Daney 2012-07-05 67 err = of_mdiobus_register(bus->mii_bus, pdev->dev.of_node);
25d967b72a92d7 David Daney 2009-10-14 68 if (err)
2fd46f47be0f96 David Daney 2012-07-05 69 goto fail_register;
25d967b72a92d7 David Daney 2009-10-14 70
1eefee901fca02 David Daney 2016-03-11 71 dev_info(&pdev->dev, "Probed\n");
25d967b72a92d7 David Daney 2009-10-14 72
25d967b72a92d7 David Daney 2009-10-14 73 return 0;
2fd46f47be0f96 David Daney 2012-07-05 74 fail_register:
25d967b72a92d7 David Daney 2009-10-14 75 mdiobus_free(bus->mii_bus);
6c17812d622a74 David Daney 2010-04-01 76 smi_en.u64 = 0;
a6d678645210f1 Radha Mohan Chintakuntla 2015-07-28 77 oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
25d967b72a92d7 David Daney 2009-10-14 78 return err;
25d967b72a92d7 David Daney 2009-10-14 79 }
25d967b72a92d7 David Daney 2009-10-14 80

:::::: The code at line 48 was first introduced by commit
:::::: 1eefee901fca0208b8a56f20cdc134e2b8638ae7 phy: mdio-octeon: Refactor into two files/modules

:::::: TO: David Daney <david.daney@xxxxxxxxxx>
:::::: 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