linux/drivers/net/wireless/rt2x00
Stephen Boyd 9acd56d3f2 rt2x00: Fix lockdep warning in rt2x00lib_probe_dev()
The rt2x00dev->intf_work workqueue is never initialized when a driver is
probed for a non-existent device (in this case rt2500usb). On such a
path we call rt2x00lib_remove_dev() to free any resources initialized
during the probe before we use INIT_WORK to initialize the workqueue.
This causes lockdep to get confused since the lock used in the workqueue
hasn't been initialized yet but is now being acquired during
cancel_work_sync() called by rt2x00lib_remove_dev().

Fix this by initializing the workqueue first before we attempt to probe
the device. This should make lockdep happy and avoid breaking any
assumptions about how the library cleans up after a probe fails.

phy0 -> rt2x00lib_probe_dev: Error - Failed to allocate device.
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
Pid: 2027, comm: modprobe Not tainted 2.6.35-rc5+ #60
Call Trace:
 [<ffffffff8105fe59>] register_lock_class+0x152/0x31f
 [<ffffffff81344a00>] ? usb_control_msg+0xd5/0x111
 [<ffffffff81061bde>] __lock_acquire+0xce/0xcf4
 [<ffffffff8105f6fd>] ? trace_hardirqs_off+0xd/0xf
 [<ffffffff81492aef>] ?  _raw_spin_unlock_irqrestore+0x33/0x41
 [<ffffffff810628d5>] lock_acquire+0xd1/0xf7
 [<ffffffff8104f037>] ? __cancel_work_timer+0x99/0x17e
 [<ffffffff8104f06e>] __cancel_work_timer+0xd0/0x17e
 [<ffffffff8104f037>] ? __cancel_work_timer+0x99/0x17e
 [<ffffffff8104f136>] cancel_work_sync+0xb/0xd
 [<ffffffffa0096675>] rt2x00lib_remove_dev+0x25/0xb0 [rt2x00lib]
 [<ffffffffa0096bf7>] rt2x00lib_probe_dev+0x380/0x3ed [rt2x00lib]
 [<ffffffff811d78a7>] ? __raw_spin_lock_init+0x31/0x52
 [<ffffffffa00bbd2c>] ? T.676+0xe/0x10 [rt2x00usb]
 [<ffffffffa00bbe4f>] rt2x00usb_probe+0x121/0x15e [rt2x00usb]
 [<ffffffff813468bd>] usb_probe_interface+0x151/0x19e
 [<ffffffff812ea08e>] driver_probe_device+0xa7/0x136
 [<ffffffff812ea167>] __driver_attach+0x4a/0x66
 [<ffffffff812ea11d>] ? __driver_attach+0x0/0x66
 [<ffffffff812e96ca>] bus_for_each_dev+0x54/0x89
 [<ffffffff812e9efd>] driver_attach+0x19/0x1b
 [<ffffffff812e9b64>] bus_add_driver+0xb4/0x204
 [<ffffffff812ea41b>] driver_register+0x98/0x109
 [<ffffffff813465dd>] usb_register_driver+0xb2/0x173
 [<ffffffffa00ca000>] ? rt2500usb_init+0x0/0x20 [rt2500usb]
 [<ffffffffa00ca01e>] rt2500usb_init+0x1e/0x20 [rt2500usb]
 [<ffffffff81000203>] do_one_initcall+0x6d/0x17a
 [<ffffffff8106cae8>] sys_init_module+0x9c/0x1e0
 [<ffffffff8100296b>] system_call_fastpath+0x16/0x1b

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-07-16 13:57:59 -04:00
..
Kconfig rt2x00: Enable RT30xx by default. 2010-05-04 13:24:23 -04:00
Makefile
rt2x00.h rt2x00: provide beacon's txdesc to write_beacon callback function. 2010-05-10 14:56:49 -04:00
rt2x00config.c
rt2x00crypto.c rt2x00: Fix setting of txdesc->length field. 2010-05-10 14:56:47 -04:00
rt2x00debug.c Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 2010-05-17 21:09:11 -07:00
rt2x00debug.h
rt2x00dev.c rt2x00: Fix lockdep warning in rt2x00lib_probe_dev() 2010-07-16 13:57:59 -04:00
rt2x00dump.h rt2x00: Dump beacons under a different identifier than TX frames. 2010-05-12 16:50:43 -04:00
rt2x00firmware.c drivers/net: remove useless semicolons 2010-05-17 22:47:34 -07:00
rt2x00ht.c rt2x00: rt2800: use correct txop value in tx descriptor 2010-05-07 14:57:21 -04:00
rt2x00leds.c
rt2x00leds.h
rt2x00lib.h
rt2x00link.c
rt2x00mac.c
rt2x00pci.c rt2x00: don't use to_pci_dev in rt2x00pci_uninitialize 2010-05-24 14:59:25 -04:00
rt2x00pci.h rt2x00: add txdesc parameter to write_tx_data 2010-04-16 15:32:00 -04:00
rt2x00queue.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2010-05-17 13:57:43 -04:00
rt2x00queue.h rt2x00: In debugfs frame dumping allow the TX descriptor to be part of the skb. 2010-05-12 16:50:52 -04:00
rt2x00reg.h rt2x00: rt2800: use correct txop value in tx descriptor 2010-05-07 14:57:21 -04:00
rt2x00soc.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
rt2x00soc.h
rt2x00usb.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2010-05-17 13:57:43 -04:00
rt2x00usb.h rt2x00: add txdesc parameter to write_tx_data 2010-04-16 15:32:00 -04:00
rt61pci.c rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions. 2010-05-24 15:07:41 -04:00
rt61pci.h
rt73usb.c rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions. 2010-05-24 15:07:41 -04:00
rt73usb.h
rt2400pci.c rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions. 2010-05-24 15:07:41 -04:00
rt2400pci.h
rt2500pci.c rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions. 2010-05-24 15:07:41 -04:00
rt2500pci.h
rt2500usb.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2010-05-17 13:57:43 -04:00
rt2500usb.h
rt2800.h rt2x00: Fix HT40+/HT40- setting in rt2800. 2010-05-04 13:24:23 -04:00
rt2800lib.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2010-05-11 14:24:55 -04:00
rt2800lib.h rt2x00: Factor out RXWI processing to common rt2800 code. 2010-05-10 14:56:48 -04:00
rt2800pci.c rt2x00: Simplify TXD handling of beacons. 2010-05-12 16:41:44 -04:00
rt2800pci.h
rt2800usb.c Revert "rt2x00: Fix rt2800usb TX descriptor writing." 2010-05-26 14:40:32 -04:00
rt2800usb.h rt2x00: Clean up rt2800usb.h. 2010-05-10 14:56:47 -04:00