Re: [PATCH v1 4/7] device property: fwnode_get_phy_mode: Change API to solve int/unit warnings

From: kbuild test robot
Date: Mon Feb 03 2020 - 03:42:53 EST


Hi Calvin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.5]
[cannot apply to driver-core/driver-core-testing net-next/master net/master linus/master sparc-next/master next-20200203]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Calvin-Johnson/ACPI-support-for-xgmac_mdio-and-dpaa2-mac-drivers/20200203-070754
base: d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
config: sparc64-randconfig-a001-20200203 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=sparc64

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

All errors (new ones prefixed by >>):

include/linux/phy.h: In function 'phy_ethtool_get_stats':
include/linux/phy.h:1260:22: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_lock(&phydev->lock);
^
include/linux/mutex.h:153:44: note: in definition of macro 'mutex_lock'
#define mutex_lock(lock) mutex_lock_nested(lock, 0)
^~~~
In file included from include/linux/property.h:16:0,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/phy.h:1261:33: error: passing argument 2 of 'phydev->drv->get_stats' from incompatible pointer type [-Werror=incompatible-pointer-types]
phydev->drv->get_stats(phydev, stats, data);
^~~~~
include/linux/phy.h:1261:33: note: expected 'struct ethtool_stats *' but argument is of type 'struct ethtool_stats *'
include/linux/phy.h:1262:24: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_unlock(&phydev->lock);
^~~~
link
In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/device.h: At top level:
include/linux/device.h:1370:27: error: conflicting types for 'dev_name'
static inline const char *dev_name(const struct device *dev)
^~~~~~~~
In file included from include/linux/property.h:16:0,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/phy.h:1076:9: note: previous implicit declaration of 'dev_name' was here
return dev_name(&phydev->mdio.dev);
^~~~~~~~
In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/device.h:1417:21: error: conflicting types for 'dev_get_drvdata'
static inline void *dev_get_drvdata(const struct device *dev)
^~~~~~~~~~~~~~~
In file included from include/linux/phy.h:18:0,
from include/linux/property.h:16,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/mdio.h:79:9: note: previous implicit declaration of 'dev_get_drvdata' was here
return dev_get_drvdata(&mdio->dev);
^~~~~~~~~~~~~~~
In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/device.h:1422:20: warning: conflicting types for 'dev_set_drvdata'
static inline void dev_set_drvdata(struct device *dev, void *data)
^~~~~~~~~~~~~~~
include/linux/device.h:1422:20: error: static declaration of 'dev_set_drvdata' follows non-static declaration
In file included from include/linux/phy.h:18:0,
from include/linux/property.h:16,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/mdio.h:74:2: note: previous implicit declaration of 'dev_set_drvdata' was here
dev_set_drvdata(&mdio->dev, data);
^~~~~~~~~~~~~~~
net/core/ethtool.c: In function 'ethtool_get_phy_stats':
>> net/core/ethtool.c:1963:45: error: passing argument 2 of 'phy_ethtool_get_stats' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = phy_ethtool_get_stats(dev->phydev, &stats, data);
^
In file included from include/linux/property.h:16:0,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/phy.h:1254:19: note: expected 'struct ethtool_stats *' but argument is of type 'struct ethtool_stats *'
static inline int phy_ethtool_get_stats(struct phy_device *phydev,
^~~~~~~~~~~~~~~~~~~~~
net/core/ethtool.c: In function 'ethtool_get_ts_info':
>> net/core/ethtool.c:2174:38: error: passing argument 2 of 'phydev->drv->ts_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
err = phydev->drv->ts_info(phydev, &info);
^
net/core/ethtool.c:2174:38: note: expected 'struct ethtool_ts_info *' but argument is of type 'struct ethtool_ts_info *'
net/core/ethtool.c: In function '__ethtool_get_module_info':
>> net/core/ethtool.c:2203:43: error: passing argument 2 of 'phydev->drv->module_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
return phydev->drv->module_info(phydev, modinfo);
^~~~~~~
net/core/ethtool.c:2203:43: note: expected 'struct ethtool_modinfo *' but argument is of type 'struct ethtool_modinfo *'
net/core/ethtool.c: In function '__ethtool_get_module_eeprom':
>> net/core/ethtool.c:2240:45: error: passing argument 2 of 'phydev->drv->module_eeprom' from incompatible pointer type [-Werror=incompatible-pointer-types]
return phydev->drv->module_eeprom(phydev, ee, data);
^~
net/core/ethtool.c:2240:45: note: expected 'struct ethtool_eeprom *' but argument is of type 'struct ethtool_eeprom *'
In file included from include/linux/notifier.h:14:0,
from include/linux/memory_hotplug.h:7,
from include/linux/mmzone.h:823,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:16,
from net/core/ethtool.c:10:
net/core/ethtool.c: In function 'get_phy_tunable':
>> net/core/ethtool.c:2487:22: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_lock(&phydev->lock);
^
include/linux/mutex.h:153:44: note: in definition of macro 'mutex_lock'
#define mutex_lock(lock) mutex_lock_nested(lock, 0)
^~~~
>> net/core/ethtool.c:2488:41: error: passing argument 2 of 'phydev->drv->get_tunable' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = phydev->drv->get_tunable(phydev, &tuna, data);
^
net/core/ethtool.c:2488:41: note: expected 'struct ethtool_tunable *' but argument is of type 'struct ethtool_tunable *'
net/core/ethtool.c:2489:24: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_unlock(&phydev->lock);
^~~~
link
In file included from include/linux/notifier.h:14:0,
from include/linux/memory_hotplug.h:7,
from include/linux/mmzone.h:823,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:16,
from net/core/ethtool.c:10:
net/core/ethtool.c: In function 'set_phy_tunable':
net/core/ethtool.c:2521:22: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_lock(&phydev->lock);
^
include/linux/mutex.h:153:44: note: in definition of macro 'mutex_lock'
#define mutex_lock(lock) mutex_lock_nested(lock, 0)
^~~~
>> net/core/ethtool.c:2522:41: error: passing argument 2 of 'phydev->drv->set_tunable' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = phydev->drv->set_tunable(phydev, &tuna, data);
^
net/core/ethtool.c:2522:41: note: expected 'struct ethtool_tunable *' but argument is of type 'struct ethtool_tunable *'
net/core/ethtool.c:2523:24: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_unlock(&phydev->lock);
^~~~
link
cc1: some warnings being treated as errors

vim +/phy_ethtool_get_stats +1963 net/core/ethtool.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 1930
f3a4094558ddf8 Andrew Lunn 2015-12-30 1931 static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr)
f3a4094558ddf8 Andrew Lunn 2015-12-30 1932 {
9994338227179e Florian Fainelli 2018-04-25 1933 const struct ethtool_ops *ops = dev->ethtool_ops;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1934 struct phy_device *phydev = dev->phydev;
9994338227179e Florian Fainelli 2018-04-25 1935 struct ethtool_stats stats;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1936 u64 *data;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1937 int ret, n_stats;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1938
9994338227179e Florian Fainelli 2018-04-25 1939 if (!phydev && (!ops->get_ethtool_phy_stats || !ops->get_sset_count))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1940 return -EOPNOTSUPP;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1941
9994338227179e Florian Fainelli 2018-04-25 1942 if (dev->phydev && !ops->get_ethtool_phy_stats)
c59530d0d5dccc Florian Fainelli 2018-04-25 1943 n_stats = phy_ethtool_get_sset_count(dev->phydev);
9994338227179e Florian Fainelli 2018-04-25 1944 else
9994338227179e Florian Fainelli 2018-04-25 1945 n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);
f3a4094558ddf8 Andrew Lunn 2015-12-30 1946 if (n_stats < 0)
f3a4094558ddf8 Andrew Lunn 2015-12-30 1947 return n_stats;
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1948 if (n_stats > S32_MAX / sizeof(u64))
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1949 return -ENOMEM;
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1950 WARN_ON_ONCE(!n_stats);
f3a4094558ddf8 Andrew Lunn 2015-12-30 1951
f3a4094558ddf8 Andrew Lunn 2015-12-30 1952 if (copy_from_user(&stats, useraddr, sizeof(stats)))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1953 return -EFAULT;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1954
f3a4094558ddf8 Andrew Lunn 2015-12-30 1955 stats.n_stats = n_stats;
3d8830266ffc28 Li RongQing 2019-03-29 1956
3d8830266ffc28 Li RongQing 2019-03-29 1957 if (n_stats) {
fad953ce0b22cf Kees Cook 2018-06-12 1958 data = vzalloc(array_size(n_stats, sizeof(u64)));
3d8830266ffc28 Li RongQing 2019-03-29 1959 if (!data)
f3a4094558ddf8 Andrew Lunn 2015-12-30 1960 return -ENOMEM;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1961
9994338227179e Florian Fainelli 2018-04-25 1962 if (dev->phydev && !ops->get_ethtool_phy_stats) {
c59530d0d5dccc Florian Fainelli 2018-04-25 @1963 ret = phy_ethtool_get_stats(dev->phydev, &stats, data);
c59530d0d5dccc Florian Fainelli 2018-04-25 1964 if (ret < 0)
3d8830266ffc28 Li RongQing 2019-03-29 1965 goto out;
9994338227179e Florian Fainelli 2018-04-25 1966 } else {
9994338227179e Florian Fainelli 2018-04-25 1967 ops->get_ethtool_phy_stats(dev, &stats, data);
9994338227179e Florian Fainelli 2018-04-25 1968 }
3d8830266ffc28 Li RongQing 2019-03-29 1969 } else {
3d8830266ffc28 Li RongQing 2019-03-29 1970 data = NULL;
3d8830266ffc28 Li RongQing 2019-03-29 1971 }
f3a4094558ddf8 Andrew Lunn 2015-12-30 1972
f3a4094558ddf8 Andrew Lunn 2015-12-30 1973 ret = -EFAULT;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1974 if (copy_to_user(useraddr, &stats, sizeof(stats)))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1975 goto out;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1976 useraddr += sizeof(stats);
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1977 if (n_stats && copy_to_user(useraddr, data, n_stats * sizeof(u64)))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1978 goto out;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1979 ret = 0;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1980
f3a4094558ddf8 Andrew Lunn 2015-12-30 1981 out:
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1982 vfree(data);
f3a4094558ddf8 Andrew Lunn 2015-12-30 1983 return ret;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1984 }
f3a4094558ddf8 Andrew Lunn 2015-12-30 1985

:::::: The code at line 1963 was first introduced by commit
:::::: c59530d0d5dccc96795af12c139f618182cf98db net: Move PHY statistics code into PHY library helpers

:::::: TO: Florian Fainelli <f.fainelli@xxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip