提交 be618f55 编写于 作者: A Amol Lad 提交者: Linus Torvalds

[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: NAmol Lad <amol@verismonetworks.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 6257b3bd
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册