net: fec: ensure fec_enet_close() copes with resume failure
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 8 Jul 2014 11:40:02 +0000 (12:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jul 2014 03:02:58 +0000 (20:02 -0700)
When the FEC is suspended, the device is detached.  Upon resume failure,
the device is left in detached mode, possibly with some of the required
clocks not running.  We don't want to be poking the device in that state
because as it may cause bus errors.

If the device is marked detached, avoid calling fec_stop().

This depends upon: "net:fec: improve safety of suspend/resume paths"

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 1cd71a8d99967be9d20fe5f535959e46c6d3b620..03785cd14b7cfc6b3e143cadacf0516f4087ad64 100644 (file)
@@ -2197,10 +2197,10 @@ fec_enet_close(struct net_device *ndev)
 
        phy_stop(fep->phy_dev);
 
-       /* Don't know what to do yet. */
        napi_disable(&fep->napi);
        netif_tx_disable(ndev);
-       fec_stop(ndev);
+       if (netif_device_present(ndev))
+               fec_stop(ndev);
 
        phy_disconnect(fep->phy_dev);
        fep->phy_dev = NULL;