Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / drivers / net / ethernet / stmicro / stmmac / stmmac_main.c
index a5b869e..4b100ef 100644 (file)
@@ -2939,12 +2939,6 @@ int stmmac_dvr_probe(struct device *device,
        spin_lock_init(&priv->lock);
        spin_lock_init(&priv->tx_lock);
 
-       ret = register_netdev(ndev);
-       if (ret) {
-               pr_err("%s: ERROR %i registering the device\n", __func__, ret);
-               goto error_netdev_register;
-       }
-
        /* If a specific clk_csr value is passed from the platform
         * this means that the CSR Clock Range selection cannot be
         * changed at run-time and it is fixed. Viceversa the driver'll try to
@@ -2969,11 +2963,21 @@ int stmmac_dvr_probe(struct device *device,
                }
        }
 
-       return 0;
+       ret = register_netdev(ndev);
+       if (ret) {
+               netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
+                          __func__, ret);
+               goto error_netdev_register;
+       }
+
+       return ret;
 
-error_mdio_register:
-       unregister_netdev(ndev);
 error_netdev_register:
+       if (priv->pcs != STMMAC_PCS_RGMII &&
+           priv->pcs != STMMAC_PCS_TBI &&
+           priv->pcs != STMMAC_PCS_RTBI)
+               stmmac_mdio_unregister(ndev);
+error_mdio_register:
        netif_napi_del(&priv->napi);
 error_hw_init:
        clk_disable_unprepare(priv->pclk);