09749851053365948da2cee6bb56a85b64155043
[openwrt.git] / target / linux / kirkwood / patches-3.10 / 0020-net-mv643xx_eth-use-phy_disconnect-instead-of-phy_de.patch
1 From 799e69d38053e344267360a583676eafe2ed8648 Mon Sep 17 00:00:00 2001
2 From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
3 Date: Wed, 29 May 2013 09:32:43 +0000
4 Subject: [PATCH 20/29] net: mv643xx_eth: use phy_disconnect instead of
5  phy_detach
6
7 Using a separated mdio bus driver with mvmdio, phy_detach on network device
8 removal will not stop the phy and finally lead to NULL pointer dereference
9 in mvmdio due to non-existent network device. Use phy_disconnect instead
10 to properly stop phy device from accessing network device prior removal of
11 the network device.
12
13 Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 ---
16  drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
17  1 file changed, 1 insertion(+), 1 deletion(-)
18
19 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
20 +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
21 @@ -2805,7 +2805,7 @@ static int mv643xx_eth_remove(struct pla
22  
23         unregister_netdev(mp->dev);
24         if (mp->phy != NULL)
25 -               phy_detach(mp->phy);
26 +               phy_disconnect(mp->phy);
27         cancel_work_sync(&mp->tx_timeout_task);
28  
29         if (!IS_ERR(mp->clk))