summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorliuguoqiang <liuguoqiang@uniontech.com>2021-11-15 10:21:39 +0100
committerJohannes Berg <johannes.berg@intel.com>2021-11-26 11:49:17 +0100
commit3536672bbdc2e7093333be85c945a63aef4c6bb8 (patch)
tree6c6bf9b9eb57c03c510b463cd33b4e44a3742ad5 /net/wireless
parentmac80211: add support for .ndo_fill_forward_path (diff)
downloadlinux-3536672bbdc2e7093333be85c945a63aef4c6bb8.tar.xz
linux-3536672bbdc2e7093333be85c945a63aef4c6bb8.zip
cfg80211: delete redundant free code
When kzalloc failed and rdev->sacn_req or rdev->scan_msg is null, pass a null pointer to kfree is redundant, delete it and return directly. Signed-off-by: liuguoqiang <liuguoqiang@uniontech.com> Link: https://lore.kernel.org/r/20211115092139.24407-1-liuguoqiang@uniontech.com [remove now unused creq = NULL assigment] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/scan.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 22e92be61938..a960940b6b75 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2687,7 +2687,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
struct cfg80211_registered_device *rdev;
struct wiphy *wiphy;
struct iw_scan_req *wreq = NULL;
- struct cfg80211_scan_request *creq = NULL;
+ struct cfg80211_scan_request *creq;
int i, err, n_channels = 0;
enum nl80211_band band;
@@ -2702,10 +2702,8 @@ int cfg80211_wext_siwscan(struct net_device *dev,
if (IS_ERR(rdev))
return PTR_ERR(rdev);
- if (rdev->scan_req || rdev->scan_msg) {
- err = -EBUSY;
- goto out;
- }
+ if (rdev->scan_req || rdev->scan_msg)
+ return -EBUSY;
wiphy = &rdev->wiphy;
@@ -2718,10 +2716,8 @@ int cfg80211_wext_siwscan(struct net_device *dev,
creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
n_channels * sizeof(void *),
GFP_ATOMIC);
- if (!creq) {
- err = -ENOMEM;
- goto out;
- }
+ if (!creq)
+ return -ENOMEM;
creq->wiphy = wiphy;
creq->wdev = dev->ieee80211_ptr;