summaryrefslogtreecommitdiffstats
path: root/drivers/bcma/main.c
diff options
context:
space:
mode:
authorSaul St. John <saul.stjohn@gmail.com>2012-08-16 22:42:30 +0200
committerJohn W. Linville <linville@tuxdriver.com>2012-09-07 21:03:35 +0200
commitee91592711ed90a1abfbb1b2ceadded11d685164 (patch)
treea87d54d00a97a61258a9882a598cba39224d0812 /drivers/bcma/main.c
parentMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlw... (diff)
downloadlinux-ee91592711ed90a1abfbb1b2ceadded11d685164.tar.xz
linux-ee91592711ed90a1abfbb1b2ceadded11d685164.zip
bcma: don't leak memory for PCIE, MIPS, GBIT cores
bcma_scan_bus allocates a bcma_core for each core found on the bus, but the memory for cores handled by the bcma driver itself was not being freed when the bus was unregistered. This patch adds special handling for the PCIE, MIPS, and GBIT COMMON cores, to ensure that their memory allocation is freed as well. Note that this patch doesn't address the memory allocated for the CC core, as that was corrected in my previous patch "bcma: register cc core driver, device." Cc: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Saul St. John <saul.stjohn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma/main.c')
-rw-r--r--drivers/bcma/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index a8f570d69075..432aeeedfd5e 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -227,7 +227,17 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)
void bcma_bus_unregister(struct bcma_bus *bus)
{
+ struct bcma_device *cores[3];
+
+ cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
+ cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE);
+ cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
+
bcma_unregister_cores(bus);
+
+ kfree(cores[2]);
+ kfree(cores[1]);
+ kfree(cores[0]);
}
int __init bcma_bus_early_register(struct bcma_bus *bus,