From: Bing Zhao Date: Sat, 20 Oct 2012 02:02:00 +0000 (-0700) Subject: mwifiex: clean up scan state on error X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6fcf2b10533bf51c67f0286ddba16e958e7ed972;p=linux-beck.git mwifiex: clean up scan state on error De-reference and deallocate scan state on failure. Signed-off-by: Bing Zhao Signed-off-by: Paul Stewart Tested-by: Paul Stewart Reviewed-by: Ryan Cairns Signed-off-by: Amitkumar Karwar Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 0679458a1bac..780d3e168297 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c @@ -1825,8 +1825,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, return -EBUSY; } - priv->scan_request = request; - priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); if (!priv->user_scan_cfg) { @@ -1834,6 +1832,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, return -ENOMEM; } + priv->scan_request = request; + priv->user_scan_cfg->num_ssids = request->n_ssids; priv->user_scan_cfg->ssid_list = request->ssids; @@ -1870,6 +1870,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); if (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; }