diff options
-rw-r--r-- | drivers/net/ethernet/renesas/ravb_main.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 630536bc72f9..f1f3be2cfe21 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c | |||
@@ -1008,7 +1008,8 @@ static int ravb_phy_init(struct net_device *ndev) | |||
1008 | of_node_put(pn); | 1008 | of_node_put(pn); |
1009 | if (!phydev) { | 1009 | if (!phydev) { |
1010 | netdev_err(ndev, "failed to connect PHY\n"); | 1010 | netdev_err(ndev, "failed to connect PHY\n"); |
1011 | return -ENOENT; | 1011 | err = -ENOENT; |
1012 | goto err_deregister_fixed_link; | ||
1012 | } | 1013 | } |
1013 | 1014 | ||
1014 | /* This driver only support 10/100Mbit speeds on Gen3 | 1015 | /* This driver only support 10/100Mbit speeds on Gen3 |
@@ -1020,8 +1021,7 @@ static int ravb_phy_init(struct net_device *ndev) | |||
1020 | err = phy_set_max_speed(phydev, SPEED_100); | 1021 | err = phy_set_max_speed(phydev, SPEED_100); |
1021 | if (err) { | 1022 | if (err) { |
1022 | netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n"); | 1023 | netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n"); |
1023 | phy_disconnect(phydev); | 1024 | goto err_phy_disconnect; |
1024 | return err; | ||
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | netdev_info(ndev, "limited PHY to 100Mbit/s\n"); | 1027 | netdev_info(ndev, "limited PHY to 100Mbit/s\n"); |
@@ -1033,6 +1033,14 @@ static int ravb_phy_init(struct net_device *ndev) | |||
1033 | phy_attached_info(phydev); | 1033 | phy_attached_info(phydev); |
1034 | 1034 | ||
1035 | return 0; | 1035 | return 0; |
1036 | |||
1037 | err_phy_disconnect: | ||
1038 | phy_disconnect(phydev); | ||
1039 | err_deregister_fixed_link: | ||
1040 | if (of_phy_is_fixed_link(np)) | ||
1041 | of_phy_deregister_fixed_link(np); | ||
1042 | |||
1043 | return err; | ||
1036 | } | 1044 | } |
1037 | 1045 | ||
1038 | /* PHY control start function */ | 1046 | /* PHY control start function */ |
@@ -1634,6 +1642,7 @@ static void ravb_set_rx_mode(struct net_device *ndev) | |||
1634 | /* Device close function for Ethernet AVB */ | 1642 | /* Device close function for Ethernet AVB */ |
1635 | static int ravb_close(struct net_device *ndev) | 1643 | static int ravb_close(struct net_device *ndev) |
1636 | { | 1644 | { |
1645 | struct device_node *np = ndev->dev.parent->of_node; | ||
1637 | struct ravb_private *priv = netdev_priv(ndev); | 1646 | struct ravb_private *priv = netdev_priv(ndev); |
1638 | struct ravb_tstamp_skb *ts_skb, *ts_skb2; | 1647 | struct ravb_tstamp_skb *ts_skb, *ts_skb2; |
1639 | 1648 | ||
@@ -1663,6 +1672,8 @@ static int ravb_close(struct net_device *ndev) | |||
1663 | if (ndev->phydev) { | 1672 | if (ndev->phydev) { |
1664 | phy_stop(ndev->phydev); | 1673 | phy_stop(ndev->phydev); |
1665 | phy_disconnect(ndev->phydev); | 1674 | phy_disconnect(ndev->phydev); |
1675 | if (of_phy_is_fixed_link(np)) | ||
1676 | of_phy_deregister_fixed_link(np); | ||
1666 | } | 1677 | } |
1667 | 1678 | ||
1668 | if (priv->chip_id != RCAR_GEN2) { | 1679 | if (priv->chip_id != RCAR_GEN2) { |