Skip to content

Commit

Permalink
[PATCH] ioremap balanced with iounmap for drivers/serial/ip22zilog.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amol Lad authored and Linus Torvalds committed Oct 1, 2006
1 parent f466413 commit 6257b3b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion drivers/serial/ip22zilog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6257b3b

Please sign in to comment.