diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2008-12-21 04:54:32 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2008-12-21 04:54:32 -0500 |
commit | 418441d9ebe84b205cb23eb0ab214c1f991621fe (patch) | |
tree | e0618291d7162abf04a478155ab7553b02213fb2 /drivers | |
parent | aec739e010f8163eac225f4e331ac7fbd59ac5c8 (diff) |
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: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/mpc52xx_uart.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index d2a1fc29834e..0c3a2ab1612c 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -1148,22 +1148,29 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match) | |||
1148 | return ret; | 1148 | return ret; |
1149 | 1149 | ||
1150 | port->mapbase = res.start; | 1150 | port->mapbase = res.start; |
1151 | if (!port->mapbase) { | ||
1152 | dev_dbg(&op->dev, "Could not allocate resources for PSC\n"); | ||
1153 | return -EINVAL; | ||
1154 | } | ||
1155 | |||
1151 | port->irq = irq_of_parse_and_map(op->node, 0); | 1156 | port->irq = irq_of_parse_and_map(op->node, 0); |
1157 | if (port->irq == NO_IRQ) { | ||
1158 | dev_dbg(&op->dev, "Could not get irq\n"); | ||
1159 | return -EINVAL; | ||
1160 | } | ||
1152 | 1161 | ||
1153 | dev_dbg(&op->dev, "mpc52xx-psc uart at %p, irq=%x, freq=%i\n", | 1162 | dev_dbg(&op->dev, "mpc52xx-psc uart at %p, irq=%x, freq=%i\n", |
1154 | (void *)port->mapbase, port->irq, port->uartclk); | 1163 | (void *)port->mapbase, port->irq, port->uartclk); |
1155 | 1164 | ||
1156 | if ((port->irq == NO_IRQ) || !port->mapbase) { | ||
1157 | printk(KERN_ERR "Could not allocate resources for PSC\n"); | ||
1158 | return -EINVAL; | ||
1159 | } | ||
1160 | |||
1161 | /* Add the port to the uart sub-system */ | 1165 | /* Add the port to the uart sub-system */ |
1162 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); | 1166 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); |
1163 | if (!ret) | 1167 | if (ret) { |
1164 | dev_set_drvdata(&op->dev, (void *)port); | 1168 | irq_dispose_mapping(port->irq); |
1169 | return ret; | ||
1170 | } | ||
1165 | 1171 | ||
1166 | return ret; | 1172 | dev_set_drvdata(&op->dev, (void *)port); |
1173 | return 0; | ||
1167 | } | 1174 | } |
1168 | 1175 | ||
1169 | static int | 1176 | static int |