aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/sfc/efx.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 343e8da1fa30..d4dc92042d77 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1614,21 +1614,24 @@ static int efx_register_netdev(struct efx_nic *efx)
1614 SET_NETDEV_DEV(net_dev, &efx->pci_dev->dev); 1614 SET_NETDEV_DEV(net_dev, &efx->pci_dev->dev);
1615 SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops); 1615 SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops);
1616 1616
1617 /* Always start with carrier off; PHY events will detect the link */
1618 netif_carrier_off(efx->net_dev);
1619
1620 /* Clear MAC statistics */ 1617 /* Clear MAC statistics */
1621 efx->mac_op->update_stats(efx); 1618 efx->mac_op->update_stats(efx);
1622 memset(&efx->mac_stats, 0, sizeof(efx->mac_stats)); 1619 memset(&efx->mac_stats, 0, sizeof(efx->mac_stats));
1623 1620
1624 rc = register_netdev(net_dev);
1625 if (rc) {
1626 EFX_ERR(efx, "could not register net dev\n");
1627 return rc;
1628 }
1629
1630 rtnl_lock(); 1621 rtnl_lock();
1622
1623 rc = dev_alloc_name(net_dev, net_dev->name);
1624 if (rc < 0)
1625 goto fail_locked;
1631 efx_update_name(efx); 1626 efx_update_name(efx);
1627
1628 rc = register_netdevice(net_dev);
1629 if (rc)
1630 goto fail_locked;
1631
1632 /* Always start with carrier off; PHY events will detect the link */
1633 netif_carrier_off(efx->net_dev);
1634
1632 rtnl_unlock(); 1635 rtnl_unlock();
1633 1636
1634 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type); 1637 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type);
@@ -1639,6 +1642,11 @@ static int efx_register_netdev(struct efx_nic *efx)
1639 1642
1640 return 0; 1643 return 0;
1641 1644
1645fail_locked:
1646 rtnl_unlock();
1647 EFX_ERR(efx, "could not register net dev\n");
1648 return rc;
1649
1642fail_registered: 1650fail_registered:
1643 unregister_netdev(net_dev); 1651 unregister_netdev(net_dev);
1644 return rc; 1652 return rc;