fix a memory leak related to request_mem_region/release_mem_region usage
cover fix a memory leak related to request_mem_region/release_mem_region usage
This serial of patches fixes a memory leak related to request_mem_region and release_mem_region usage.
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.
Axel Lin (4):
[ARM] davinci_mmc: fix a memory leak
[ARM] mvsdio: fix a memory leak
[ARM] pxamci: fix a memory leak
[ARM] mxcmmc: remove a unnecessary release_resource() call
drivers/mmc/host/davinci_mmc.c | 5 +++-- drivers/mmc/host/mvsdio.c | 4 ++-- drivers/mmc/host/mxcmmc.c | 1 - drivers/mmc/host/pxamci.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.2
PATCH 1/4 davinci_mmc: fix a memory leak
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.
--- drivers/mmc/host/davinci_mmc.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/davinci_mmc.c +3 -2
@@ -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); }
Signature · 1 line
1.7.2
PATCH 2/4 mvsdio: fix a memory leak
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.
--- drivers/mmc/host/mvsdio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/mvsdio.c +2 -2
@@ -825,7 +825,7 @@ out:iounmap (host->base); }if (r) -release_resource (r); +release_mem_region (r->start,SZ_1K );if (mmc)mmc_free_host (mmc);
@@ -850,7 +850,7 @@ static int __exit mvsd_remove(struct platform_device *pdev)del_timer_sync (&host->timer);mvsd_power_down (host);iounmap (host->base); -release_resource (host->res); +release_mem_region (host->res->start,SZ_1K );mmc_free_host (mmc); }platform_set_drvdata (pdev,NULL );
Signature · 1 line
1.7.2
PATCH 3/4 pxamci: fix a memory leak
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.
--- drivers/mmc/host/pxamci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/pxamci.c +2 -2
@@ -774,7 +774,7 @@ err_gpio_ro: }if (mmc)mmc_free_host (mmc); -release_resource (r); +release_mem_region (r->start,SZ_4K );return ret; }
@@ -824,7 +824,7 @@ static int pxamci_remove(struct platform_device *pdev)clk_put (host->clk); -release_resource (host->res); +release_mem_region (host->res->start,SZ_4K );mmc_free_host (mmc); }
Signature · 1 line
1.7.2
PATCH 4/4 mxcmmc: remove a unnecessary release_resource() call
Remove release_resource() after release_mem_region().
--- drivers/mmc/host/mxcmmc.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mmc/host/mxcmmc.c +0 -1
@@ -967,7 +967,6 @@ static int mxcmci_remove(struct platform_device *pdev)clk_put (host->clk);release_mem_region (host->res->start,resource_size (host->res)); -release_resource (host->res);mmc_free_host (mmc);
Signature · 1 line
1.7.2
Re: [PATCH 4/4] [ARM] mxcmmc: remove a unnecessary release_resource() call
Quoted 3 lines · Axel Lin
Remove
release_resource()afterrelease_mem_region().Signed-off-by Axel Lin <[email protected]>
Quoted 22 lines
--- drivers/mmc/host/mxcmmc.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)drivers/mmc/host/mxcmmc.c +0
-1@@ -967,7 +967,6 @@ static int mxcmci_remove(struct platform_device *pdev)clk_put (host->clk);release_mem_region (host->res->start,resource_size (host->res)); -release_resource (host->res);mmc_free_host (mmc);Signature · 1 line
1.7.2
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Chris Ball
AppliedRe: [PATCH 4/4] [ARM] mxcmmc: remove a unnecessary release_resource() call
Hi,
Quoted 18 lines · Sascha Hauer
Quoted 3 lines · Axel Lin
Remove
release_resource()afterrelease_mem_region().Signed-off-by Axel Lin <[email protected]>Acked-by Sascha Hauer <[email protected]>Quoted 11 lines
--- drivers/mmc/host/mxcmmc.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)drivers/mmc/host/mxcmmc.c +0
-0@@ -967,7 +967,6 @@ static int mxcmci_remove(struct platform_device *pdev)clk_put (host->clk);
Quoted 5 lines
drivers/mmc/host/mxcmmc.c static int mxcmci_remove(struct platform_device *pdev) · line 972
Quoted 5 lines
drivers/mmc/host/mxcmmc.c +0
-1release_mem_region (host->res->start,resource_size (host->res)); -release_resource (host->res);mmc_free_host (mmc);
Pushed to mmc-next for .38, thanks.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child