diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-07-08 00:22:59 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-07 21:21:22 -0700 |
commit | 0b146ca8d467c1dc6ad50628089d183608a47e40 (patch) | |
tree | 4b4b5026eee78729e679dc617d2bbe3574017034 | |
parent | 635cf17ce220aa4fef93528775646e0a181b2dc2 (diff) | |
download | linux-0b146ca8d467c1dc6ad50628089d183608a47e40.tar.bz2 |
net: fec: ensure that a disconnected phy isn't configured
When we disconnect from a phy, we should forget our pointer to it so we
don't accidentally try to configure it. We handle a NULL phy pointer
correctly in most places, except fec_enet_set_pauseparam(). Fix this
too.
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 6a03d7eced4d..cf805468eecc 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1875,6 +1875,9 @@ static int fec_enet_set_pauseparam(struct net_device *ndev, { struct fec_enet_private *fep = netdev_priv(ndev); + if (!fep->phy_dev) + return -ENODEV; + if (pause->tx_pause != pause->rx_pause) { netdev_info(ndev, "hardware only support enable/disable both tx and rx"); @@ -2186,6 +2189,7 @@ fec_enet_close(struct net_device *ndev) phy_stop(fep->phy_dev); phy_disconnect(fep->phy_dev); + fep->phy_dev = NULL; fec_enet_clk_enable(ndev, false); pinctrl_pm_select_sleep_state(&fep->pdev->dev); |