diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-11-08 00:35:10 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-11-08 01:08:42 -0500 |
commit | 899be96db75451ba98cb217109ef4cf2ee6de927 (patch) | |
tree | b84ded26b414c160a6a430f55b38f4cc9c28dfa7 | |
parent | 151f52f09c5728ecfdd0c289da1a4b30bb416f2c (diff) |
rtc: rtc-sh - 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.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | 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 5efbd5990ff8..06e41ed93230 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -761,7 +761,7 @@ err_unmap: | |||
761 | clk_put(rtc->clk); | 761 | clk_put(rtc->clk); |
762 | iounmap(rtc->regbase); | 762 | iounmap(rtc->regbase); |
763 | err_badmap: | 763 | err_badmap: |
764 | release_resource(rtc->res); | 764 | release_mem_region(rtc->res->start, rtc->regsize); |
765 | err_badres: | 765 | err_badres: |
766 | kfree(rtc); | 766 | kfree(rtc); |
767 | 767 | ||
@@ -786,7 +786,7 @@ static int __exit sh_rtc_remove(struct platform_device *pdev) | |||
786 | } | 786 | } |
787 | 787 | ||
788 | iounmap(rtc->regbase); | 788 | iounmap(rtc->regbase); |
789 | release_resource(rtc->res); | 789 | release_mem_region(rtc->res->start, rtc->regsize); |
790 | 790 | ||
791 | clk_disable(rtc->clk); | 791 | clk_disable(rtc->clk); |
792 | clk_put(rtc->clk); | 792 | clk_put(rtc->clk); |