Skip to content

Commit

Permalink
smsc911x: fix BUG if module is removed while interface is up
Browse files Browse the repository at this point in the history
If the module is removed while its interface is up, smsc911x_stop is not
called until after smsc911x_drv_remove has disposed of phy_dev.  This
patch changes the stop method to handle this situation.

This is a different problem to the one reported by dfoley@telus.net.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Steve Glendinning authored and David S. Miller committed Dec 26, 2008
1 parent 6332178 commit dd04519
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand All @@ -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;
Expand Down

0 comments on commit dd04519

Please sign in to comment.