aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/mpc52xx_uart.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 7708e5dd3656..dbad0e31e005 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)
338static int 338static int
339mpc52xx_uart_request_port(struct uart_port *port) 339mpc52xx_uart_request_port(struct uart_port *port)
340{ 340{
341 int err;
342
341 if (port->flags & UPF_IOREMAP) /* Need to remap ? */ 343 if (port->flags & UPF_IOREMAP) /* Need to remap ? */
342 port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE); 344 port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE);
343 345
344 if (!port->membase) 346 if (!port->membase)
345 return -EINVAL; 347 return -EINVAL;
346 348
347 return request_mem_region(port->mapbase, MPC52xx_PSC_SIZE, 349 err = request_mem_region(port->mapbase, MPC52xx_PSC_SIZE,
348 "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY; 350 "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY;
351
352 if (err && (port->flags & UPF_IOREMAP)) {
353 iounmap(port->membase);
354 port->membase = NULL;
355 }
356
357 return err;
349} 358}
350 359
351static void 360static void