net: ethernet: hisi_femac: Call SET_NETDEV_DEV()
authorDongpo Li <lidongpo@hisilicon.com>
Mon, 12 Dec 2016 12:03:42 +0000 (20:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Dec 2016 18:29:35 +0000 (13:29 -0500)
The hisi_femac driver calls into PHYLIB which now checks for
net_device->dev.parent, so make sure we do set it before calling into
any MDIO/PHYLIB related function.

Fixes: ec988ad78ed6 ("phy: Don't increment MDIO bus refcount unless it's a different owner")
Signed-off-by: Dongpo Li <lidongpo@hisilicon.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hisi_femac.c

index 49863068c59e3cb4ecb4c24128326cbd4c42e37a..979852d56f31ddb7301c7be19f2f91d922ef5e33 100644 (file)
@@ -805,6 +805,7 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        platform_set_drvdata(pdev, ndev);
+       SET_NETDEV_DEV(ndev, &pdev->dev);
 
        priv = netdev_priv(ndev);
        priv->dev = dev;
@@ -882,7 +883,6 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
        ndev->netdev_ops = &hisi_femac_netdev_ops;
        ndev->ethtool_ops = &hisi_femac_ethtools_ops;
        netif_napi_add(ndev, &priv->napi, hisi_femac_poll, FEMAC_POLL_WEIGHT);
-       SET_NETDEV_DEV(ndev, &pdev->dev);
 
        hisi_femac_port_init(priv);