]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/smsc911x.c
smsc911x: fix BUG if module is removed while interface is up
[linux-2.6-omap-h63xx.git] / drivers / net / smsc911x.c
index ecdde03d4167984c1afc67865b973e26556abd82..8078f3545f160b2b65890295372bf5bdd57a3072 100644 (file)
@@ -1267,8 +1267,6 @@ static int smsc911x_stop(struct net_device *dev)
        struct smsc911x_data *pdata = netdev_priv(dev);
        unsigned int temp;
 
-       BUG_ON(!pdata->phy_dev);
-
        /* Disable all device interrupts */
        temp = smsc911x_reg_read(pdata, INT_CFG);
        temp &= ~INT_CFG_IRQ_EN_;
@@ -1283,7 +1281,8 @@ static int smsc911x_stop(struct net_device *dev)
        smsc911x_tx_update_txcounters(dev);
 
        /* Bring the PHY down */
-       phy_stop(pdata->phy_dev);
+       if (pdata->phy_dev)
+               phy_stop(pdata->phy_dev);
 
        SMSC_TRACE(IFDOWN, "Interface stopped");
        return 0;