summaryrefslogtreecommitdiffstats
path: root/drivers/serial/ip22zilog.c
diff options
context:
space:
mode:
authorAmol Lad <amol@verismonetworks.com>2006-10-01 08:29:22 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 09:39:32 +0200
commit6257b3bdfde4295c04872d710c2419ff8efc1b86 (patch)
tree443b1cb09a00eeeeef789af521d9a3c0adad9c79 /drivers/serial/ip22zilog.c
parent[PATCH] ioremap balanced with iounmap for drivers/serial/ioc4_serial.c (diff)
downloadlinux-6257b3bdfde4295c04872d710c2419ff8efc1b86.tar.xz
linux-6257b3bdfde4295c04872d710c2419ff8efc1b86.zip
[PATCH] ioremap balanced with iounmap for drivers/serial/ip22zilog.c
ioremap must be balanced by an iounmap and failing to do so can result in a memory leak. Signed-off-by: Amol Lad <amol@verismonetworks.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/serial/ip22zilog.c')
-rw-r--r--drivers/serial/ip22zilog.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 5ff269fb604c..dbf13c03a1bb 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -1229,13 +1229,27 @@ static int __init ip22zilog_init(void)
static void __exit ip22zilog_exit(void)
{
int i;
+ struct uart_ip22zilog_port *up;
for (i = 0; i < NUM_CHANNELS; i++) {
- struct uart_ip22zilog_port *up = &ip22zilog_port_table[i];
+ up = &ip22zilog_port_table[i];
uart_remove_one_port(&ip22zilog_reg, &up->port);
}
+ /* Free IO mem */
+ up = &ip22zilog_port_table[0];
+ for (i = 0; i < NUM_IP22ZILOG; i++) {
+ if (up[(i * 2) + 0].port.mapbase) {
+ iounmap((void*)up[(i * 2) + 0].port.mapbase);
+ up[(i * 2) + 0].port.mapbase = 0;
+ }
+ if (up[(i * 2) + 1].port.mapbase) {
+ iounmap((void*)up[(i * 2) + 1].port.mapbase);
+ up[(i * 2) + 1].port.mapbase = 0;
+ }
+ }
+
uart_unregister_driver(&ip22zilog_reg);
}