* [PATCH] rtc: rtc-sh - fix a memory leak
@ 2010-11-08 5:35 Axel Lin
2010-11-08 5:48 ` Paul Mundt
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-11-08 5:35 UTC (permalink / raw)
To: linux-kernel; +Cc: Alessandro Zummo, rtc-linux, Andrew Morton, Paul Mundt
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/rtc/rtc-sh.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 5efbd59..06e41ed 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -761,7 +761,7 @@ err_unmap:
clk_put(rtc->clk);
iounmap(rtc->regbase);
err_badmap:
- release_resource(rtc->res);
+ release_mem_region(rtc->res->start, rtc->regsize);
err_badres:
kfree(rtc);
@@ -786,7 +786,7 @@ static int __exit sh_rtc_remove(struct platform_device *pdev)
}
iounmap(rtc->regbase);
- release_resource(rtc->res);
+ release_mem_region(rtc->res->start, rtc->regsize);
clk_disable(rtc->clk);
clk_put(rtc->clk);
--
1.7.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: rtc-sh - fix a memory leak
2010-11-08 5:35 [PATCH] rtc: rtc-sh - fix a memory leak Axel Lin
@ 2010-11-08 5:48 ` Paul Mundt
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2010-11-08 5:48 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Alessandro Zummo, rtc-linux, Andrew Morton
On Mon, Nov 08, 2010 at 01:35:10PM +0800, Axel Lin wrote:
> 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>
Good catch! Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-08 5:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-08 5:35 [PATCH] rtc: rtc-sh - fix a memory leak Axel Lin
2010-11-08 5:48 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox