Skip to content

Commit

Permalink
net: fec: correct fix method about miss init spinlock
Browse files Browse the repository at this point in the history
Old method will cause init spinlock twice.
New method will avoid init spinlock twice and fix miss init spinlock
at fec_restart.

BUG: spinlock bad magic on CPU#1, swapper/0/1
lock: 0xbfae0f8c, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
Backtrace:
 [<80011d54>] (dump_backtrace+0x0/0x10c) from [<804e7800>] (dump_stack+0x18/0x1c)
 r6:bfae0000 r5:bfae0f8c r4:00000000 r3:806c1310
 [<804e77e8>] (dump_stack+0x0/0x1c) from [<804e9f20>] (spin_dump+0x80/0x94)
 [<804e9ea0>] (spin_dump+0x0/0x94) from [<804e9f60>] (spin_bug+0x2c/0x30)
 r5:805f6f8c r4:bfae0f8c
 [<804e9f34>] (spin_bug+0x0/0x30) from [<80257984>] (do_raw_spin_lock+0x170/0x1b0                                         )
 r5:806b4950 r4:bfae0f8c
 [<80257814>] (do_raw_spin_lock+0x0/0x1b0) from [<804ed15c>] (_raw_spin_lock_irqs                                         ave+0x18/0x20)
 [<804ed144>] (_raw_spin_lock_irqsave+0x0/0x20) from [<8033c694>] (fec_ptp_start_                                         cyclecounter+0x3c/0x120)
 r4:bfae0f8c r3:00000002
 [<8033c658>] (fec_ptp_start_cyclecounter+0x0/0x120) from [<80339e08>] (fec_resta                                         rt+0x56c/0x5f8)
 r8:00000000 r7:806e6f48 r6:00000112 r5:806b4950 r4:bfae0000
 [<8033989c>] (fec_restart+0x0/0x5f8) from [<8033b9e4>] (fec_probe+0x508/0xa48)

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Frank Li authored and David S. Miller committed Feb 8, 2013
1 parent 41b7492 commit 365cc17
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/ethernet/freescale/fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,6 @@ static int fec_enet_init(struct net_device *ndev)
}

spin_lock_init(&fep->hw_lock);
spin_lock_init(&fep->tmreg_lock);

fep->netdev = ndev;

Expand Down Expand Up @@ -1841,6 +1840,9 @@ fec_probe(struct platform_device *pdev)

fec_reset_phy(pdev);

if (fep->bufdesc_ex)
fec_ptp_init(ndev, pdev);

ret = fec_enet_init(ndev);
if (ret)
goto failed_init;
Expand All @@ -1856,9 +1858,6 @@ fec_probe(struct platform_device *pdev)
if (ret)
goto failed_register;

if (fep->bufdesc_ex)
fec_ptp_init(ndev, pdev);

return 0;

failed_register:
Expand Down

0 comments on commit 365cc17

Please sign in to comment.