diff options
author | Amol Lad <amol@verismonetworks.com> | 2006-09-30 23:29:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 00:39:32 -0700 |
commit | be618f550cb499db263e2ce22c5ad4f4dbfd53e6 (patch) | |
tree | a0ea46641aea148aee5ee5bc46d87b2f2d1a9f88 /drivers/serial | |
parent | 6257b3bdfde4295c04872d710c2419ff8efc1b86 (diff) | |
download | kernel_samsung_tuna-be618f550cb499db263e2ce22c5ad4f4dbfd53e6.zip kernel_samsung_tuna-be618f550cb499db263e2ce22c5ad4f4dbfd53e6.tar.gz kernel_samsung_tuna-be618f550cb499db263e2ce22c5ad4f4dbfd53e6.tar.bz2 |
[PATCH] ioremap balanced with iounmap for drivers/serial/mpc52xx_uart.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')
-rw-r--r-- | drivers/serial/mpc52xx_uart.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 7708e5d..dbad0e3 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c @@ -338,14 +338,23 @@ mpc52xx_uart_release_port(struct uart_port *port) static int mpc52xx_uart_request_port(struct uart_port *port) { + int err; + if (port->flags & UPF_IOREMAP) /* Need to remap ? */ port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE); if (!port->membase) return -EINVAL; - return request_mem_region(port->mapbase, MPC52xx_PSC_SIZE, + err = request_mem_region(port->mapbase, MPC52xx_PSC_SIZE, "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY; + + if (err && (port->flags & UPF_IOREMAP)) { + iounmap(port->membase); + port->membase = NULL; + } + + return err; } static void |