diff mbox

drivers: net: xgene: fix: Oops in linkwatch_fire_event

Message ID 1440540183-11006-1-git-send-email-isubramanian@apm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Iyappan Subramanian Aug. 25, 2015, 10:03 p.m. UTC
[ 1065.801569] Internal error: Oops: 96000006 [#1] SMP
...
[ 1065.866655] Hardware name: AppliedMicro Mustang/Mustang, BIOS 1.1.0 Apr 22 2015
[ 1065.873937] Workqueue: events_power_efficient phy_state_machine
[ 1065.879837] task: fffffe01de105e80 ti: fffffe00bcf18000 task.ti: fffffe00bcf18000
[ 1065.887288] PC is at linkwatch_fire_event+0xac/0xc0
[ 1065.892141] LR is at linkwatch_fire_event+0xa0/0xc0
[ 1065.896995] pc : [<fffffe000060284c>] lr : [<fffffe0000602840>] pstate: 200001c5
[ 1065.904356] sp : fffffe00bcf1bd00
...
[ 1066.196813] Call Trace:
[ 1066.199248] [<fffffe000060284c>] linkwatch_fire_event+0xac/0xc0
[ 1066.205140] [<fffffe000061167c>] netif_carrier_off+0x54/0x64
[ 1066.210773] [<fffffe00004f1654>] phy_state_machine+0x120/0x3bc
[ 1066.216578] [<fffffe00000d8d10>] process_one_work+0x15c/0x3a8
[ 1066.222296] [<fffffe00000d9090>] worker_thread+0x134/0x470
[ 1066.227757] [<fffffe00000df014>] kthread+0xe0/0xf8
[ 1066.232525] Code: 97f65ee9 f9420660 d538d082 8b000042 (885f7c40)

The fix is to call phy_disconnect() from xgene_enet_mdio_remove,
which in turn call cancel_delayed_work_sync().

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c   | 3 +++
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

David Miller Aug. 26, 2015, 12:06 a.m. UTC | #1
From: Iyappan Subramanian <isubramanian@apm.com>
Date: Tue, 25 Aug 2015 15:03:03 -0700

> [ 1065.801569] Internal error: Oops: 96000006 [#1] SMP
> ...
> [ 1065.866655] Hardware name: AppliedMicro Mustang/Mustang, BIOS 1.1.0 Apr 22 2015
> [ 1065.873937] Workqueue: events_power_efficient phy_state_machine
> [ 1065.879837] task: fffffe01de105e80 ti: fffffe00bcf18000 task.ti: fffffe00bcf18000
> [ 1065.887288] PC is at linkwatch_fire_event+0xac/0xc0
> [ 1065.892141] LR is at linkwatch_fire_event+0xa0/0xc0
> [ 1065.896995] pc : [<fffffe000060284c>] lr : [<fffffe0000602840>] pstate: 200001c5
> [ 1065.904356] sp : fffffe00bcf1bd00
> ...
> [ 1066.196813] Call Trace:
> [ 1066.199248] [<fffffe000060284c>] linkwatch_fire_event+0xac/0xc0
> [ 1066.205140] [<fffffe000061167c>] netif_carrier_off+0x54/0x64
> [ 1066.210773] [<fffffe00004f1654>] phy_state_machine+0x120/0x3bc
> [ 1066.216578] [<fffffe00000d8d10>] process_one_work+0x15c/0x3a8
> [ 1066.222296] [<fffffe00000d9090>] worker_thread+0x134/0x470
> [ 1066.227757] [<fffffe00000df014>] kthread+0xe0/0xf8
> [ 1066.232525] Code: 97f65ee9 f9420660 d538d082 8b000042 (885f7c40)
> 
> The fix is to call phy_disconnect() from xgene_enet_mdio_remove,
> which in turn call cancel_delayed_work_sync().
> 
> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index a626c43..cfa3704 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -801,6 +801,9 @@  int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata)
 
 void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata)
 {
+	if (pdata->phy_dev)
+		phy_disconnect(pdata->phy_dev);
+
 	mdiobus_unregister(pdata->mdio_bus);
 	mdiobus_free(pdata->mdio_bus);
 	pdata->mdio_bus = NULL;
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 299eb43..a02ea7f8 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1277,9 +1277,10 @@  static int xgene_enet_remove(struct platform_device *pdev)
 	mac_ops->tx_disable(pdata);
 
 	xgene_enet_napi_del(pdata);
-	xgene_enet_mdio_remove(pdata);
-	xgene_enet_delete_desc_rings(pdata);
+	if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
+		xgene_enet_mdio_remove(pdata);
 	unregister_netdev(ndev);
+	xgene_enet_delete_desc_rings(pdata);
 	pdata->port_ops->shutdown(pdata);
 	free_netdev(ndev);