tree:
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git master
head: 52755b66ddcef2e897778fac5656df18817b59ab
commit: 902a66e08ceaadb9a7a1ab3a4f3af611cd1d8cba [13/24] lan743x: correctly handle chips
with internal PHY
config: x86_64-randconfig-r034-20201111 (attached as .config)
compiler: clang version 12.0.0 (
https://github.com/llvm/llvm-project
a719eef73ec447b2c5fc8b70f69564a2e0f78e1e)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
#
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id...
git remote add netdev-net
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
git fetch --no-tags netdev-net master
git checkout 902a66e08ceaadb9a7a1ab3a4f3af611cd1d8cba
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> drivers/net/ethernet/microchip/lan743x_main.c:1030:6: warning:
variable 'phydev' is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
if (phynode) {
^~~~~~~
drivers/net/ethernet/microchip/lan743x_main.c:1049:7: note: uninitialized use occurs
here
if (!phydev) {
^~~~~~
drivers/net/ethernet/microchip/lan743x_main.c:1030:2: note: remove the 'if' if
its condition is always true
if (phynode) {
^~~~~~~~~~~~~
drivers/net/ethernet/microchip/lan743x_main.c:1023:27: note: initialize the variable
'phydev' to silence this warning
struct phy_device *phydev;
^
= NULL
1 warning generated.
vim +1030 drivers/net/ethernet/microchip/lan743x_main.c
23f0703c125be49 Bryan Whitehead 2018-03-05 1018
23f0703c125be49 Bryan Whitehead 2018-03-05 1019 static int lan743x_phy_open(struct
lan743x_adapter *adapter)
23f0703c125be49 Bryan Whitehead 2018-03-05 1020 {
23f0703c125be49 Bryan Whitehead 2018-03-05 1021 struct lan743x_phy *phy =
&adapter->phy;
6f197fb63850b26 Roelof Berg 2020-05-29 1022 struct device_node *phynode;
23f0703c125be49 Bryan Whitehead 2018-03-05 1023 struct phy_device *phydev;
23f0703c125be49 Bryan Whitehead 2018-03-05 1024 struct net_device *netdev;
23f0703c125be49 Bryan Whitehead 2018-03-05 1025 int ret = -EIO;
23f0703c125be49 Bryan Whitehead 2018-03-05 1026
23f0703c125be49 Bryan Whitehead 2018-03-05 1027 netdev = adapter->netdev;
6f197fb63850b26 Roelof Berg 2020-05-29 1028 phynode =
of_node_get(adapter->pdev->dev.of_node);
6f197fb63850b26 Roelof Berg 2020-05-29 1029
6f197fb63850b26 Roelof Berg 2020-05-29 @1030 if (phynode) {
902a66e08ceaadb Sven Van Asbroeck 2020-11-08 1031 /* try devicetree phy, or fixed link
*/
6f197fb63850b26 Roelof Berg 2020-05-29 1032 of_get_phy_mode(phynode,
&adapter->phy_mode);
6f197fb63850b26 Roelof Berg 2020-05-29 1033
6f197fb63850b26 Roelof Berg 2020-05-29 1034 if (of_phy_is_fixed_link(phynode))
{
6f197fb63850b26 Roelof Berg 2020-05-29 1035 ret =
of_phy_register_fixed_link(phynode);
6f197fb63850b26 Roelof Berg 2020-05-29 1036 if (ret) {
6f197fb63850b26 Roelof Berg 2020-05-29 1037 netdev_err(netdev,
6f197fb63850b26 Roelof Berg 2020-05-29 1038 "cannot register fixed
PHY\n");
6f197fb63850b26 Roelof Berg 2020-05-29 1039 of_node_put(phynode);
6f197fb63850b26 Roelof Berg 2020-05-29 1040 goto return_error;
6f197fb63850b26 Roelof Berg 2020-05-29 1041 }
6f197fb63850b26 Roelof Berg 2020-05-29 1042 }
6f197fb63850b26 Roelof Berg 2020-05-29 1043 phydev = of_phy_connect(netdev,
phynode,
6f197fb63850b26 Roelof Berg 2020-05-29 1044 lan743x_phy_link_status_change,
0,
6f197fb63850b26 Roelof Berg 2020-05-29 1045 adapter->phy_mode);
6f197fb63850b26 Roelof Berg 2020-05-29 1046 of_node_put(phynode);
902a66e08ceaadb Sven Van Asbroeck 2020-11-08 1047 }
902a66e08ceaadb Sven Van Asbroeck 2020-11-08 1048
902a66e08ceaadb Sven Van Asbroeck 2020-11-08 1049 if (!phydev) {
902a66e08ceaadb Sven Van Asbroeck 2020-11-08 1050 /* try internal phy */
23f0703c125be49 Bryan Whitehead 2018-03-05 1051 phydev =
phy_find_first(adapter->mdiobus);
23f0703c125be49 Bryan Whitehead 2018-03-05 1052 if (!phydev)
23f0703c125be49 Bryan Whitehead 2018-03-05 1053 goto return_error;
23f0703c125be49 Bryan Whitehead 2018-03-05 1054
902a66e08ceaadb Sven Van Asbroeck 2020-11-08 1055 adapter->phy_mode =
PHY_INTERFACE_MODE_GMII;
23f0703c125be49 Bryan Whitehead 2018-03-05 1056 ret = phy_connect_direct(netdev,
phydev,
23f0703c125be49 Bryan Whitehead 2018-03-05 1057 lan743x_phy_link_status_change,
6f197fb63850b26 Roelof Berg 2020-05-29 1058 adapter->phy_mode);
23f0703c125be49 Bryan Whitehead 2018-03-05 1059 if (ret)
23f0703c125be49 Bryan Whitehead 2018-03-05 1060 goto return_error;
6f197fb63850b26 Roelof Berg 2020-05-29 1061 }
23f0703c125be49 Bryan Whitehead 2018-03-05 1062
23f0703c125be49 Bryan Whitehead 2018-03-05 1063 /* MAC doesn't support 1000T Half
*/
41124fa64d4b298 Andrew Lunn 2018-09-12 1064 phy_remove_link_mode(phydev,
ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
23f0703c125be49 Bryan Whitehead 2018-03-05 1065
23f0703c125be49 Bryan Whitehead 2018-03-05 1066 /* support both flow controls */
af8d9bb2f2f405a Andrew Lunn 2018-09-12 1067 phy_support_asym_pause(phydev);
23f0703c125be49 Bryan Whitehead 2018-03-05 1068 phy->fc_request_control =
(FLOW_CTRL_RX | FLOW_CTRL_TX);
23f0703c125be49 Bryan Whitehead 2018-03-05 1069 phy->fc_autoneg =
phydev->autoneg;
23f0703c125be49 Bryan Whitehead 2018-03-05 1070
23f0703c125be49 Bryan Whitehead 2018-03-05 1071 phy_start(phydev);
23f0703c125be49 Bryan Whitehead 2018-03-05 1072 phy_start_aneg(phydev);
23f0703c125be49 Bryan Whitehead 2018-03-05 1073 return 0;
23f0703c125be49 Bryan Whitehead 2018-03-05 1074
23f0703c125be49 Bryan Whitehead 2018-03-05 1075 return_error:
23f0703c125be49 Bryan Whitehead 2018-03-05 1076 return ret;
23f0703c125be49 Bryan Whitehead 2018-03-05 1077 }
23f0703c125be49 Bryan Whitehead 2018-03-05 1078
:::::: The code at line 1030 was first introduced by commit
:::::: 6f197fb63850b26ef8f70f1bfe5900e377910a5a lan743x: Added fixed link and RGMII
support
:::::: TO: Roelof Berg <rberg(a)berg-solutions.de>
:::::: CC: David S. Miller <davem(a)davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org