Skip to content

Commit 1ed0d56

Browse files
Fabio Estevamdavem330
authored andcommitted
fec: Invert the order of function calls in fec_restart()
commit 54309fa ("net: fec: fix kernel oops when plug/unplug cable many times") introduced the following 'if' block in the beginning of fec_start(): if (netif_running(ndev)) { netif_device_detach(ndev); napi_disable(&fep->napi); netif_stop_queue(ndev); netif_tx_lock_bh(ndev); } Then later in the end of fec_restart() there is another block that calls the opposite of each one of these functions. The correct approach would be to also call them with in the reverse order, so that we have as result: if (netif_running(ndev)) { netif_tx_unlock_bh(ndev); netif_wake_queue(ndev); napi_enable(&fep->napi); netif_device_attach(ndev); } Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3169134 commit 1ed0d56

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ fec_restart(struct net_device *ndev, int duplex)
616616
writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
617617

618618
if (netif_running(ndev)) {
619-
netif_device_attach(ndev);
620-
napi_enable(&fep->napi);
621-
netif_wake_queue(ndev);
622619
netif_tx_unlock_bh(ndev);
620+
netif_wake_queue(ndev);
621+
napi_enable(&fep->napi);
622+
netif_device_attach(ndev);
623623
}
624624
}
625625

0 commit comments

Comments
 (0)