Commit 6fcf2b10 authored by Bing Zhao's avatar Bing Zhao Committed by John W. Linville

mwifiex: clean up scan state on error

De-reference and deallocate scan state on failure.
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarPaul Stewart <pstew@chromium.org>
Tested-by: default avatarPaul Stewart <pstew@chromium.org>
Reviewed-by: default avatarRyan Cairns <rtc@chromium.org>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent dcd5c79c
...@@ -1825,8 +1825,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, ...@@ -1825,8 +1825,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
return -EBUSY; return -EBUSY;
} }
priv->scan_request = request;
priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg),
GFP_KERNEL); GFP_KERNEL);
if (!priv->user_scan_cfg) { if (!priv->user_scan_cfg) {
...@@ -1834,6 +1832,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, ...@@ -1834,6 +1832,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
return -ENOMEM; return -ENOMEM;
} }
priv->scan_request = request;
priv->user_scan_cfg->num_ssids = request->n_ssids; priv->user_scan_cfg->num_ssids = request->n_ssids;
priv->user_scan_cfg->ssid_list = request->ssids; priv->user_scan_cfg->ssid_list = request->ssids;
...@@ -1870,6 +1870,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, ...@@ -1870,6 +1870,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); ret = mwifiex_scan_networks(priv, priv->user_scan_cfg);
if (ret) { if (ret) {
dev_err(priv->adapter->dev, "scan failed: %d\n", ret); dev_err(priv->adapter->dev, "scan failed: %d\n", ret);
priv->scan_request = NULL;
kfree(priv->user_scan_cfg);
priv->user_scan_cfg = NULL;
return ret; return ret;
} }
......
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