Skip to content

Commit

Permalink
NET: fec: only enable napi if we are successful
Browse files Browse the repository at this point in the history
If napi is left enabled after a failed attempt to bring the interface
up, we BUG:

fec 2188000.ethernet eth0: no PHY, assuming direct connection to switch
libphy: PHY fixed-0:00 not found
fec 2188000.ethernet eth0: could not attach to PHY
------------[ cut here ]------------
kernel BUG at include/linux/netdevice.h:502!
Internal error: Oops - BUG: 0 [wandboard-org#1] SMP ARM
...
PC is at fec_enet_open+0x4d0/0x500
LR is at __dev_open+0xa4/0xfc

Only enable napi after we are past all the failure paths.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Fugang Duan authored and Nitin Garg committed Apr 16, 2014
1 parent 2b5491d commit 4e7c655
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,8 +2079,6 @@ fec_enet_open(struct net_device *ndev)

fec_enet_clk_enable(ndev, true);

napi_enable(&fep->napi);

/* I should reset the ring buffers here, but I don't yet know
* a simple way to do that.
*/
Expand All @@ -2096,6 +2094,7 @@ fec_enet_open(struct net_device *ndev)
return ret;
}

napi_enable(&fep->napi);
phy_start(fep->phy_dev);
netif_tx_start_all_queues(ndev);
fep->opened = 1;
Expand Down

0 comments on commit 4e7c655

Please sign in to comment.