Commit 3536672b authored by liuguoqiang's avatar liuguoqiang Committed by Johannes Berg

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: default avatarliuguoqiang <liuguoqiang@uniontech.com>
Link: https://lore.kernel.org/r/20211115092139.24407-1-liuguoqiang@uniontech.com
[remove now unused creq = NULL assigment]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent d787a3e3
...@@ -2687,7 +2687,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, ...@@ -2687,7 +2687,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
struct cfg80211_registered_device *rdev; struct cfg80211_registered_device *rdev;
struct wiphy *wiphy; struct wiphy *wiphy;
struct iw_scan_req *wreq = NULL; struct iw_scan_req *wreq = NULL;
struct cfg80211_scan_request *creq = NULL; struct cfg80211_scan_request *creq;
int i, err, n_channels = 0; int i, err, n_channels = 0;
enum nl80211_band band; enum nl80211_band band;
...@@ -2702,10 +2702,8 @@ int cfg80211_wext_siwscan(struct net_device *dev, ...@@ -2702,10 +2702,8 @@ int cfg80211_wext_siwscan(struct net_device *dev,
if (IS_ERR(rdev)) if (IS_ERR(rdev))
return PTR_ERR(rdev); return PTR_ERR(rdev);
if (rdev->scan_req || rdev->scan_msg) { if (rdev->scan_req || rdev->scan_msg)
err = -EBUSY; return -EBUSY;
goto out;
}
wiphy = &rdev->wiphy; wiphy = &rdev->wiphy;
...@@ -2718,10 +2716,8 @@ int cfg80211_wext_siwscan(struct net_device *dev, ...@@ -2718,10 +2716,8 @@ int cfg80211_wext_siwscan(struct net_device *dev,
creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) + creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
n_channels * sizeof(void *), n_channels * sizeof(void *),
GFP_ATOMIC); GFP_ATOMIC);
if (!creq) { if (!creq)
err = -ENOMEM; return -ENOMEM;
goto out;
}
creq->wiphy = wiphy; creq->wiphy = wiphy;
creq->wdev = dev->ieee80211_ptr; creq->wdev = dev->ieee80211_ptr;
......
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