From: Johannes Berg Date: Wed, 24 Oct 2012 08:04:58 +0000 (+0200) Subject: nl80211: move "can set channel" check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=71fe96bf9db8b117d28de6f9ced606cae2ad9661;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 --- diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8c0857815a90..879ca620fd6f 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) result = 0; mutex_lock(&rdev->mtx); - } else if (nl80211_can_set_dev_channel(netdev->ieee80211_ptr)) + } else wdev = netdev->ieee80211_ptr; - else - wdev = NULL; /* * 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) } if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { - result = __nl80211_set_channel(rdev, wdev, info); + result = __nl80211_set_channel(rdev, + nl80211_can_set_dev_channel(wdev) ? wdev : NULL, + info); if (result) goto bad_res; }