lkml.org 
[lkml]   [2010]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 1/4] [ARM] davinci_mmc: fix a memory leak
From
Date
request_mem_region() will call kzalloc to allocate memory for struct resource.
release_resource() unregisters the resource but does not free the allocated
memory, thus use release_mem_region() instead to fix the memory leak.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mmc/host/davinci_mmc.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index e15547c..7c7d268 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1297,7 +1297,7 @@ cpu_freq_fail:
mmc_free_host(mmc);

if (mem)
- release_resource(mem);
+ release_mem_region(mem->start, resource_size(mem));

dev_dbg(&pdev->dev, "probe err %d\n", ret);

@@ -1322,7 +1322,8 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)

iounmap(host->base);

- release_resource(host->mem_res);
+ release_mem_region(host->mem_res->start,
+ resource_size(host->mem_res));

mmc_free_host(host->mmc);
}
--
1.7.2




\
 
 \ /
  Last update: 2010-11-22 09:41    [W:0.024 / U:3.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site