]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
net: wireless: bcmdhd: Fix country code map mem leak
authorMichael Hsu <mhsu@nvidia.com>
Thu, 15 Oct 2015 02:14:52 +0000 (19:14 -0700)
committermobile promotions <svcmobile_promotions@nvidia.com>
Sat, 17 Oct 2015 08:41:07 +0000 (01:41 -0700)
Free country code map buffer when adapter is removed.

Bug 200143482

Change-Id: Iab82b3b56ec07a99a3d3012b2931c51ddecbc502
Signed-off-by: Michael Hsu <mhsu@nvidia.com>
Reviewed-on: http://git-master/r/817916
Reviewed-by: Nagaraj Annaiah <nannaiah@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
drivers/net/wireless/bcmdhd/dhd_linux_platdev.c

index cf9d5de3224885f40e73b3636f4518ba21522e76..0e624f4556ce1c62d833e24d4892a986de65920b 100644 (file)
@@ -443,6 +443,15 @@ fail:
        adapter->n_country = 0;
        return -1;
 }
+
+static void wifi_platform_free_country_code_map(wifi_adapter_info_t *adapter)
+{
+       if (adapter->country_code_map) {
+               kfree(adapter->country_code_map);
+               adapter->country_code_map = NULL;
+       }
+       adapter->n_country = 0;
+}
 #endif
 
 static int wifi_plat_dev_drv_probe(struct platform_device *pdev)
@@ -521,6 +530,9 @@ static int wifi_plat_dev_drv_remove(struct platform_device *pdev)
 #endif /* BCMPCIE */
        }
 
+#ifdef NV_COUNTRY_CODE
+       wifi_platform_free_country_code_map(adapter);
+#endif
        sysedp_free_consumer(adapter->sysedpc);
        adapter->sysedpc = NULL;