UPSTREAM: 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>

Bug: 215824523
(cherry picked from commit 3536672bbd)
Change-Id: I650e011e4bb5def81f0af15cff74fbe4fe0424f7
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
This commit is contained in:
liuguoqiang
2021-11-15 17:21:39 +08:00
committed by Todd Kjos
parent b03386aee2
commit 58ea06f6b2

View File

@@ -2676,7 +2676,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;
@@ -2691,10 +2691,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;
@@ -2707,10 +2705,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;