Skip to contentSkip to conversation

drivers/net/ethernet/microchip/lan743x_main.c:1049 lan743x_phy_open() error: uninitialized symbol 'phydev'.

PATCH In review Dan Carpenter 2 participants 2 messages Nov 13, 2020 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 4603/5468 drivers/net/ethernet/microchip/lan743x_main.c:1049 lan743x_phy_open() error: uninitialized symbol 'phydev'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a60b1e1fe9ca5f9d9a79e89a8d71228a8e04d35c
commit: 902a66e08ceaadb9a7a1ab3a4f3af611cd1d8cba [4603/5468] lan743x: correctly handle chips with internal PHY
config: x86_64-randconfig-m001-20201111 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate

smatch warnings:
drivers/net/ethernet/microchip/lan743x_main.c:1049 lan743x_phy_open() error: uninitialized symbol 'phydev'.

vim +/phydev +1049 drivers/net/ethernet/microchip/lan743x_main.c

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  	}

Not initialized on else path.

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)

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

#1 lore raw
Quoted 9 lines · On Fri, 13 Nov 2020 16:24:03 +0300 Dan Carpenter wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a60b1e1fe9ca5f9d9a79e89a8d71228a8e04d35c
commit: 902a66e08ceaadb9a7a1ab3a4f3af611cd1d8cba [4603/5468] lan743x: correctly handle chips with internal PHY
config: x86_64-randconfig-m001-20201111 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate

Thanks, this is already fixes in net and Linus's tree:

edbc21113bde ("lan743x: fix use of uninitialized variable")