Fix for phy_disconnect bug

Disconnect the phy device only if there is a PHY connected.
If the phy_mask is zero, the phydev pointer is null, therefore
check the phydevice before disconnection.

Signed-off-by: Chaithrika U S <chaithr...@ti.com>
---
 drivers/net/davinci_emac.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 7358eb9..80b6e68 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2541,7 +2541,8 @@ static int emac_dev_stop(struct net_device *ndev)
        emac_cleanup_rxch(priv, EMAC_DEF_RX_CH);
        emac_write(EMAC_SOFTRESET, 1);
 
-       phy_disconnect(priv->phydev);
+       if (priv->phydev)
+               phy_disconnect(priv->phydev);
 
        /* Free IRQ */
        while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, i))) {
-- 
1.5.6

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to