Commit 418441d9 authored by Wolfram Sang's avatar Wolfram Sang Committed by Grant Likely

powerpc/mpc5200: fix error paths in PSC UART probe function

- error cases for mapbase and irq were unbundled
- mapped irq now gets disposed on error
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent aec739e0
...@@ -1148,22 +1148,29 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match) ...@@ -1148,22 +1148,29 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
return ret; return ret;
port->mapbase = res.start; port->mapbase = res.start;
if (!port->mapbase) {
dev_dbg(&op->dev, "Could not allocate resources for PSC\n");
return -EINVAL;
}
port->irq = irq_of_parse_and_map(op->node, 0); port->irq = irq_of_parse_and_map(op->node, 0);
if (port->irq == NO_IRQ) {
dev_dbg(&op->dev, "Could not get irq\n");
return -EINVAL;
}
dev_dbg(&op->dev, "mpc52xx-psc uart at %p, irq=%x, freq=%i\n", dev_dbg(&op->dev, "mpc52xx-psc uart at %p, irq=%x, freq=%i\n",
(void *)port->mapbase, port->irq, port->uartclk); (void *)port->mapbase, port->irq, port->uartclk);
if ((port->irq == NO_IRQ) || !port->mapbase) {
printk(KERN_ERR "Could not allocate resources for PSC\n");
return -EINVAL;
}
/* Add the port to the uart sub-system */ /* Add the port to the uart sub-system */
ret = uart_add_one_port(&mpc52xx_uart_driver, port); ret = uart_add_one_port(&mpc52xx_uart_driver, port);
if (!ret) if (ret) {
dev_set_drvdata(&op->dev, (void *)port); irq_dispose_mapping(port->irq);
return ret; return ret;
}
dev_set_drvdata(&op->dev, (void *)port);
return 0;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment