diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-03-22 19:34:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:11 -0400 |
commit | a844b43ca078d7dd8f0cd13c6f030ec62a996975 (patch) | |
tree | c74c3ffe40ae31026e69e916ecaec29f5b239982 /drivers/misc | |
parent | 6f7d485e13c6c07348cf9cfd1b735fe1bcf3caa9 (diff) |
drivers/misc/atmel_tclib.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.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/atmel_tclib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c index 3891124001f2..a844810b50f6 100644 --- a/drivers/misc/atmel_tclib.c +++ b/drivers/misc/atmel_tclib.c | |||
@@ -75,7 +75,7 @@ out: | |||
75 | return tc; | 75 | return tc; |
76 | 76 | ||
77 | fail_ioremap: | 77 | fail_ioremap: |
78 | release_resource(r); | 78 | release_mem_region(r->start, ATMEL_TC_IOMEM_SIZE); |
79 | fail: | 79 | fail: |
80 | tc = NULL; | 80 | tc = NULL; |
81 | goto out; | 81 | goto out; |
@@ -95,7 +95,7 @@ void atmel_tc_free(struct atmel_tc *tc) | |||
95 | spin_lock(&tc_list_lock); | 95 | spin_lock(&tc_list_lock); |
96 | if (tc->regs) { | 96 | if (tc->regs) { |
97 | iounmap(tc->regs); | 97 | iounmap(tc->regs); |
98 | release_resource(tc->iomem); | 98 | release_mem_region(tc->iomem->start, ATMEL_TC_IOMEM_SIZE); |
99 | tc->regs = NULL; | 99 | tc->regs = NULL; |
100 | tc->iomem = NULL; | 100 | tc->iomem = NULL; |
101 | } | 101 | } |