Commit 83286856 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Johannes Berg

nl80211: Remove a misleading label in 'nl80211_trigger_scan()'

Since commit 5fe231e8 ("cfg80211: vastly simplify locking"), the
'unlock' label at the end of 'nl80211_trigger_scan()' is useless and
misleading, because nothing is unlocked there.

Direct return can be used instead of 'err = -<error code>; goto unlock;'
construction.

Remove this label and simplify code accordingly.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20200712173539.274395-1-christophe.jaillet@wanadoo.frSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent dec4ca93
...@@ -7774,10 +7774,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -7774,10 +7774,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
if (!rdev->ops->scan) if (!rdev->ops->scan)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (rdev->scan_req || rdev->scan_msg) { if (rdev->scan_req || rdev->scan_msg)
err = -EBUSY; return -EBUSY;
goto unlock;
}
if (info->attrs[NL80211_ATTR_SCAN_FREQ_KHZ]) { if (info->attrs[NL80211_ATTR_SCAN_FREQ_KHZ]) {
if (!wiphy_ext_feature_isset(wiphy, if (!wiphy_ext_feature_isset(wiphy,
...@@ -7790,10 +7788,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -7790,10 +7788,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
if (scan_freqs) { if (scan_freqs) {
n_channels = validate_scan_freqs(scan_freqs); n_channels = validate_scan_freqs(scan_freqs);
if (!n_channels) { if (!n_channels)
err = -EINVAL; return -EINVAL;
goto unlock;
}
} else { } else {
n_channels = ieee80211_get_num_supported_channels(wiphy); n_channels = ieee80211_get_num_supported_channels(wiphy);
} }
...@@ -7802,29 +7798,23 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -7802,29 +7798,23 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp)
n_ssids++; n_ssids++;
if (n_ssids > wiphy->max_scan_ssids) { if (n_ssids > wiphy->max_scan_ssids)
err = -EINVAL; return -EINVAL;
goto unlock;
}
if (info->attrs[NL80211_ATTR_IE]) if (info->attrs[NL80211_ATTR_IE])
ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
else else
ie_len = 0; ie_len = 0;
if (ie_len > wiphy->max_scan_ie_len) { if (ie_len > wiphy->max_scan_ie_len)
err = -EINVAL; return -EINVAL;
goto unlock;
}
request = kzalloc(sizeof(*request) request = kzalloc(sizeof(*request)
+ sizeof(*request->ssids) * n_ssids + sizeof(*request->ssids) * n_ssids
+ sizeof(*request->channels) * n_channels + sizeof(*request->channels) * n_channels
+ ie_len, GFP_KERNEL); + ie_len, GFP_KERNEL);
if (!request) { if (!request)
err = -ENOMEM; return -ENOMEM;
goto unlock;
}
if (n_ssids) if (n_ssids)
request->ssids = (void *)&request->channels[n_channels]; request->ssids = (void *)&request->channels[n_channels];
...@@ -8013,7 +8003,6 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -8013,7 +8003,6 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
kfree(request); kfree(request);
} }
unlock:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment