]> git.baikalelectronics.ru Git - kernel.git/commit
fec: Invert the order of function calls in fec_restart()
authorFabio Estevam <fabio.estevam@freescale.com>
Wed, 15 May 2013 07:06:27 +0000 (07:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 May 2013 21:42:15 +0000 (14:42 -0700)
commit2bfc5a84c69fd737d7361a3592ce8c7e367227c9
tree55b88d5fd4bc5d6d4be8cdbd40971d67c08d8c3b
parentbfdb4ccf1cdda1bec76b7898ba81c38f5de54e31
fec: Invert the order of function calls in fec_restart()

commit 56eda0ec ("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>
drivers/net/ethernet/freescale/fec_main.c