From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frank Li Subject: [PATCH net-next 4/7] net:fec: ensure that a disconnected phy isn't configured Date: Tue, 29 Apr 2014 20:09:07 +0800 Message-ID: <1398773350-7293-4-git-send-email-Frank.Li@freescale.com> References: <1398773350-7293-1-git-send-email-Frank.Li@freescale.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Frank Li To: , , , , Return-path: Received: from mail-bn1blp0187.outbound.protection.outlook.com ([207.46.163.187]:58171 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754554AbaD2Nfb (ORCPT ); Tue, 29 Apr 2014 09:35:31 -0400 In-Reply-To: <1398773350-7293-1-git-send-email-Frank.Li@freescale.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Russell King 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 Signed-off-by: Frank Li --- 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