From patchwork Fri Dec 19 14:03:38 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Glendinning X-Patchwork-Id: 14827 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 4BBAEDDF3E for ; Sat, 20 Dec 2008 01:03:44 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753279AbYLSODj (ORCPT ); Fri, 19 Dec 2008 09:03:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753263AbYLSODj (ORCPT ); Fri, 19 Dec 2008 09:03:39 -0500 Received: from [86.54.240.115] ([86.54.240.115]:51016 "EHLO drevil2.shawell.net" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753257AbYLSODi (ORCPT ); Fri, 19 Dec 2008 09:03:38 -0500 Received: from localhost.localdomain (unknown [10.0.20.15]) by drevil2.shawell.net (Postfix) with ESMTP id E70AF37962; Fri, 19 Dec 2008 14:03:35 +0000 (GMT) From: Steve Glendinning To: netdev@vger.kernel.org Cc: Ian Saturley , Steve Glendinning Subject: [PATCH] smsc911x: fix BUG if module is removed while interface is up Date: Fri, 19 Dec 2008 14:03:38 +0000 Message-Id: <1229695418-27275-1-git-send-email-steve.glendinning@smsc.com> X-Mailer: git-send-email 1.6.0.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- drivers/net/smsc911x.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index fa28542..552e97f 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c @@ -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;