Re: [PATCH v2 net-next 1/3] net: macb: Reorganize macb_mii bringup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Brad,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Brad-Mouring/net-macb-Reorganize-macb_mii-bringup/20180311-133616
config: i386-randconfig-x012-201810 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/cadence/macb_main.c: In function 'macb_probe':
>> drivers/net/ethernet/cadence/macb_main.c:503:8: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
        if (ret)
           ^
   drivers/net/ethernet/cadence/macb_main.c:477:6: note: 'ret' was declared here
     int ret, i;
         ^~~

vim +/ret +503 drivers/net/ethernet/cadence/macb_main.c

   468	
   469	/* based on au1000_eth. c*/
   470	static int macb_mii_probe(struct net_device *dev)
   471	{
   472		struct macb *bp = netdev_priv(dev);
   473		struct macb_platform_data *pdata = dev_get_platdata(&bp->pdev->dev);
   474		struct phy_device *phydev;
   475		struct device_node *np = bp->pdev->dev.of_node;
   476		int phy_irq;
   477		int ret, i;
   478	
   479		if (np) {
   480			if (of_phy_is_fixed_link(np)) {
   481				if (of_phy_register_fixed_link(np) < 0) {
   482					dev_err(&bp->pdev->dev,
   483						"broken fixed-link specification\n");
   484					return -ENODEV;
   485				}
   486				bp->phy_node = of_node_get(np);
   487			} else {
   488				/* fallback to standard phy registration if no phy were
   489				 * found during dt phy registration
   490				 */
   491				if (!phy_find_first(bp->mii_bus)) {
   492					for (i = 0; i < PHY_MAX_ADDR; i++) {
   493						struct phy_device *phydev;
   494	
   495						phydev = mdiobus_scan(bp->mii_bus, i);
   496						if (IS_ERR(phydev) &&
   497						    PTR_ERR(phydev) != -ENODEV) {
   498							ret = PTR_ERR(phydev);
   499							break;
   500						}
   501					}
   502	
 > 503					if (ret)
   504						return -ENODEV;
   505				}
   506			}
   507		} else {
   508			for (i = 0; i < PHY_MAX_ADDR; i++)
   509				bp->mii_bus->irq[i] = PHY_POLL;
   510	
   511			if (pdata)
   512				bp->mii_bus->phy_mask = pdata->phy_mask;
   513	
   514		}
   515	
   516		if (bp->phy_node) {
   517			phydev = of_phy_connect(dev, bp->phy_node,
   518						&macb_handle_link_change, 0,
   519						bp->phy_interface);
   520			if (!phydev)
   521				return -ENODEV;
   522		} else {
   523			phydev = phy_find_first(bp->mii_bus);
   524			if (!phydev) {
   525				netdev_err(dev, "no PHY found\n");
   526				return -ENXIO;
   527			}
   528	
   529			if (pdata) {
   530				if (gpio_is_valid(pdata->phy_irq_pin)) {
   531					ret = devm_gpio_request(&bp->pdev->dev,
   532								pdata->phy_irq_pin, "phy int");
   533					if (!ret) {
   534						phy_irq = gpio_to_irq(pdata->phy_irq_pin);
   535						phydev->irq = (phy_irq < 0) ? PHY_POLL : phy_irq;
   536					}
   537				} else {
   538					phydev->irq = PHY_POLL;
   539				}
   540			}
   541	
   542			/* attach the mac to the phy */
   543			ret = phy_connect_direct(dev, phydev, &macb_handle_link_change,
   544						 bp->phy_interface);
   545			if (ret) {
   546				netdev_err(dev, "Could not attach to PHY\n");
   547				return ret;
   548			}
   549		}
   550	
   551		/* mask with MAC supported features */
   552		if (macb_is_gem(bp) && bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE)
   553			phydev->supported &= PHY_GBIT_FEATURES;
   554		else
   555			phydev->supported &= PHY_BASIC_FEATURES;
   556	
   557		if (bp->caps & MACB_CAPS_NO_GIGABIT_HALF)
   558			phydev->supported &= ~SUPPORTED_1000baseT_Half;
   559	
   560		phydev->advertising = phydev->supported;
   561	
   562		bp->link = 0;
   563		bp->speed = 0;
   564		bp->duplex = -1;
   565	
   566		return 0;
   567	}
   568	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux