[TG3]: netif_carrier_off runs too early; could still be queued when init fails
authorJeff Mahoney <jeffm@suse.com>
Tue, 21 Mar 2006 06:39:21 +0000 (22:39 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Mar 2006 06:39:21 +0000 (22:39 -0800)
commit59f1741e541bf4f6139599389610a70de49c3ad2
tree55892d15e9122a83dc0c4fa6496dfcf52bd4346d
parent87546b1c25daa2c72ba6741c777f76c1eac6e2d9
[TG3]: netif_carrier_off runs too early; could still be queued when init fails

Move the netif_carrier_off() call from tg3_init_one()->
tg3_init_link_config() to tg3_open() as is the convention for most other
network drivers.

I was getting a panic after a tg3 device failed to initialize due to DMA
failure.  The oops pointed to the link watch queue with spinlock debugging
enabled.  Without spinlock debugging, the Oops didn't occur.

I suspect that the link event was getting queued but not executed until
after the DMA test had failed and the device was freed.  The link event was
then operating on freed memory, which could contain anything.  With this
patch applied, the Oops no longer occurs.

[ Based upon feedback from Michael Chan, we move netif_carrier_off()
  to the end of tg3_init_one() instead of moving it to tg3_open() -DaveM ]

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c