Commit 899be96d authored by Axel Lin's avatar Axel Lin Committed by Paul Mundt

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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 151f52f0
...@@ -761,7 +761,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev) ...@@ -761,7 +761,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
clk_put(rtc->clk); clk_put(rtc->clk);
iounmap(rtc->regbase); iounmap(rtc->regbase);
err_badmap: err_badmap:
release_resource(rtc->res); release_mem_region(rtc->res->start, rtc->regsize);
err_badres: err_badres:
kfree(rtc); kfree(rtc);
...@@ -786,7 +786,7 @@ static int __exit sh_rtc_remove(struct platform_device *pdev) ...@@ -786,7 +786,7 @@ static int __exit sh_rtc_remove(struct platform_device *pdev)
} }
iounmap(rtc->regbase); iounmap(rtc->regbase);
release_resource(rtc->res); release_mem_region(rtc->res->start, rtc->regsize);
clk_disable(rtc->clk); clk_disable(rtc->clk);
clk_put(rtc->clk); clk_put(rtc->clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment