linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rt2x00: fix a wrong parameter for __test_and_clear_bit() in rt2x00rfkill_free().
@ 2009-01-13 22:00 Rami Rosen
  2009-01-13 22:46 ` Ivo van Doorn
  0 siblings, 1 reply; 2+ messages in thread
From: Rami Rosen @ 2009-01-13 22:00 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, rt2400-devel, IvDoorn

When running modprobe rt73usb, and then rmmod rt73usb, and then
iwconfig, the wlan0 device does not disappear. When repeating this
process again, we get a kernel Oops errors and "BUG: unable to handle
kernel paging request..." message in the kernel log.

The reason for this is that there is an error in rt2x00rfkill_free(),
which is called in the process of removing the device
(rt2x00lib_remove_dev() in rt2x00dev.c).
rt2x00rfkill_free() clears the RFKILL_STATE_ALLOCATED bit , which is
bit number 1 () in rt2x00dev->flags instead of in
rt2x00dev->rfkill_state. As a result, when checking the
DEVICE_STATE_REGISTERED_HW bit (bit number 1 in rt2x00dev->flags) in
rt2x00lib_remove_hw() it is **unset**, and we wrongly **don't** call
ieee80211_unregister_hw().

This patch corrects this: the parameter for __test_and_clear_bit() in
rt2x00rfkill_free() should be &rt2x00dev->rfkill_state and not
&rt2x00dev->flags.

Signed-off-by: Rami Rosen <ramirose@gmail.com>

---
(wireless-testing).

diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
index 0b089ec..735a22d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
+++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
@@ -118,7 +118,7 @@ void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)

 void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
 {
-	if (!__test_and_clear_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->flags))
+	if (!__test_and_clear_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
 		return;

 	input_free_polled_device(rt2x00dev->rfkill_poll_dev);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-13 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-13 22:00 [PATCH] rt2x00: fix a wrong parameter for __test_and_clear_bit() in rt2x00rfkill_free() Rami Rosen
2009-01-13 22:46 ` Ivo van Doorn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).