diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-01-12 17:00:05 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 08:03:12 -0800 |
commit | 19412ce9fcc9ca2d0f5b62af15c63381f0ac9657 (patch) | |
tree | 61c93d1a1a1290683483a67b943cb49a1276a251 /drivers/rtc | |
parent | 554ec37aca8f5fbe4d70df462d7032aaa5d95ae9 (diff) | |
download | kernel_samsung_smdk4412-19412ce9fcc9ca2d0f5b62af15c63381f0ac9657.tar.gz kernel_samsung_smdk4412-19412ce9fcc9ca2d0f5b62af15c63381f0ac9657.tar.bz2 kernel_samsung_smdk4412-19412ce9fcc9ca2d0f5b62af15c63381f0ac9657.zip |
drivers/rtc/rtc-omap.c: 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.
Also add a missing iounmap() in omap_rtc_remove().
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Tony Lindgren <tony@atomide.com>
Acked-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-omap.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 73377b0d65d..e72b523c79a 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -429,13 +429,14 @@ fail1: fail0: iounmap(rtc_base); fail: - release_resource(mem); + release_mem_region(mem->start, resource_size(mem)); return -EIO; } static int __exit omap_rtc_remove(struct platform_device *pdev) { struct rtc_device *rtc = platform_get_drvdata(pdev); + struct resource *mem = dev_get_drvdata(&rtc->dev); device_init_wakeup(&pdev->dev, 0); @@ -447,8 +448,9 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) if (omap_rtc_timer != omap_rtc_alarm) free_irq(omap_rtc_alarm, rtc); - release_resource(dev_get_drvdata(&rtc->dev)); rtc_device_unregister(rtc); + iounmap(rtc_base); + release_mem_region(mem->start, resource_size(mem)); return 0; } |