summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2013-07-22 19:17:48 -0700
committerJohn W. Linville <linville@tuxdriver.com>2013-07-24 11:02:08 -0400
commit003d87cbece50c2a558c954b7ce915dcc70acba7 (patch)
tree254432c236a5a24a4ee1fd9bf086f443f45c02d5 /drivers/net/wireless/mwifiex
parent43ba6b9f2f5e8090f16e8efe19d17cc8ce291d22 (diff)
mwifiex: move del_timer_sync(scan_delay_timer) call to fix memleak
Currently it is in mwifiex_adapter_cleanup() which doesn't get called if driver initialization is failed causing memory leak. scan_delay_timer is initialized in mwifiex_register(), so it should be deleted in mwifiex_unregister(). Hence it has been moved to appropriate place. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/init.c7
-rw-r--r--drivers/net/wireless/mwifiex/main.c1
2 files changed, 1 insertions, 7 deletions
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index fb86cec1b5c..f23520f4771 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -378,18 +378,11 @@ static void mwifiex_free_lock_list(struct mwifiex_adapter *adapter)
static void
mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter)
{
- int i;
-
if (!adapter) {
pr_err("%s: adapter is NULL\n", __func__);
return;
}
- for (i = 0; i < adapter->priv_num; i++) {
- if (adapter->priv[i])
- del_timer_sync(&adapter->priv[i]->scan_delay_timer);
- }
-
mwifiex_cancel_all_pending_cmd(adapter);
/* Free lock variables */
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index e15ab72fb03..ef151c58ac1 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -197,6 +197,7 @@ static int mwifiex_unregister(struct mwifiex_adapter *adapter)
for (i = 0; i < adapter->priv_num; i++) {
if (adapter->priv[i]) {
mwifiex_free_curr_bcn(adapter->priv[i]);
+ del_timer_sync(&adapter->priv[i]->scan_delay_timer);
kfree(adapter->priv[i]);
}
}