Skip to content

Commit

Permalink
rt2x00: Fix rfkill structure initialization to prevent rfkill WARN_ON.
Browse files Browse the repository at this point in the history
The state field of the rfkill structure was incorrectly initialized to -1, which results in rfkill
issueing a WARN_ON. Fix this by initializing the state field to the proper value as indicated by
the driver.

Signed-off-by: Gertjan van Wingerde <[email protected]>
Signed-off-by: Ivo van Doorn <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
Gertjan van Wingerde authored and linvjw committed Oct 6, 2008
1 parent f74b6a5 commit 5b5d13a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/wireless/rt2x00/rt2x00rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,15 @@ void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)

rt2x00dev->rfkill->name = rt2x00dev->ops->name;
rt2x00dev->rfkill->data = rt2x00dev;
rt2x00dev->rfkill->state = -1;
rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio;
if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) {
rt2x00dev->rfkill->get_state = rt2x00rfkill_get_state;
rt2x00dev->rfkill->state =
rt2x00dev->ops->lib->rfkill_poll(rt2x00dev) ?
RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED;
} else {
rt2x00dev->rfkill->state = RFKILL_STATE_UNBLOCKED;
}

INIT_DELAYED_WORK(&rt2x00dev->rfkill_work, rt2x00rfkill_poll);

Expand Down

0 comments on commit 5b5d13a

Please sign in to comment.