diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-10-24 04:04:58 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-10-30 04:11:33 -0400 |
commit | 71fe96bf9db8b117d28de6f9ced606cae2ad9661 (patch) | |
tree | d764bfd5d36c488190a87f50b6abb0ee579710c0 | |
parent | e826117142d87c5fbdfd17a053f6a33ec90b20a4 (diff) |
nl80211: move "can set channel" check
Setting the wdev to NULL when the channel can't be
set for that interface type (to treat the channel
setting for the wiphy/monitor) currently works, but
is confusing in the code if netdev/wdev aren't both
set/unset in the same way. Move the check whether
the channel can be set to where it's needed so that
wdev and netdev are always both assigned or NULL.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/wireless/nl80211.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8c0857815a9..879ca620fd6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1516,10 +1516,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1516 | result = 0; | 1516 | result = 0; |
1517 | 1517 | ||
1518 | mutex_lock(&rdev->mtx); | 1518 | mutex_lock(&rdev->mtx); |
1519 | } else if (nl80211_can_set_dev_channel(netdev->ieee80211_ptr)) | 1519 | } else |
1520 | wdev = netdev->ieee80211_ptr; | 1520 | wdev = netdev->ieee80211_ptr; |
1521 | else | ||
1522 | wdev = NULL; | ||
1523 | 1521 | ||
1524 | /* | 1522 | /* |
1525 | * end workaround code, by now the rdev is available | 1523 | * end workaround code, by now the rdev is available |
@@ -1579,7 +1577,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1579 | } | 1577 | } |
1580 | 1578 | ||
1581 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { | 1579 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { |
1582 | result = __nl80211_set_channel(rdev, wdev, info); | 1580 | result = __nl80211_set_channel(rdev, |
1581 | nl80211_can_set_dev_channel(wdev) ? wdev : NULL, | ||
1582 | info); | ||
1583 | if (result) | 1583 | if (result) |
1584 | goto bad_res; | 1584 | goto bad_res; |
1585 | } | 1585 | } |