[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1398773350-7293-4-git-send-email-Frank.Li@freescale.com>
Date: Tue, 29 Apr 2014 20:09:07 +0800
From: Frank Li <Frank.Li@...escale.com>
To: <lznuaa@...il.com>, <shawn.guo@...aro.org>, <B38611@...escale.com>,
<davem@...emloft.net>, <rmk+kernel@....linux.org.uk>
CC: <linux-arm-kernel@...ts.infradead.org>, <netdev@...r.kernel.org>,
Frank Li <Frank.Li@...escale.com>
Subject: [PATCH net-next 4/7] net:fec: ensure that a disconnected phy isn't configured
From: Russell King <rmk+kernel@....linux.org.uk>
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.
Signed-off-by: Russell King <rmk+kernel@....linux.org.uk>
Signed-off-by: Frank Li <Frank.Li@...escale.com>
---
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 b7a5614..9de899e 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1496,6 +1496,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");
@@ -1800,6 +1803,7 @@ fec_enet_close(struct net_device *ndev)
phy_stop(fep->phy_dev);
phy_disconnect(fep->phy_dev);
+ fep->phy_dev = NULL;
fec_enet_free_buffers(ndev);
--
1.7.8
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists