summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/efm32-uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/efm32-uart.c')
-rw-r--r--drivers/tty/serial/efm32-uart.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c
index 7d199c8e1a75..0eb5b5673ede 100644
--- a/drivers/tty/serial/efm32-uart.c
+++ b/drivers/tty/serial/efm32-uart.c
@@ -268,10 +268,10 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data)
handled = IRQ_HANDLED;
}
- tty_flip_buffer_push(tport);
-
spin_unlock(&port->lock);
+ tty_flip_buffer_push(tport);
+
return handled;
}
@@ -698,6 +698,7 @@ static int efm32_uart_probe(struct platform_device *pdev)
{
struct efm32_uart_port *efm_port;
struct resource *res;
+ unsigned int line;
int ret;
efm_port = kzalloc(sizeof(*efm_port), GFP_KERNEL);
@@ -750,18 +751,21 @@ static int efm32_uart_probe(struct platform_device *pdev)
if (pdata)
efm_port->pdata = *pdata;
- }
+ } else if (ret < 0)
+ goto err_probe_dt;
+
+ line = efm_port->port.line;
- if (efm_port->port.line >= 0 &&
- efm_port->port.line < ARRAY_SIZE(efm32_uart_ports))
- efm32_uart_ports[efm_port->port.line] = efm_port;
+ if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
+ efm32_uart_ports[line] = efm_port;
ret = uart_add_one_port(&efm32_uart_reg, &efm_port->port);
if (ret) {
dev_dbg(&pdev->dev, "failed to add port: %d\n", ret);
- if (pdev->id >= 0 && pdev->id < ARRAY_SIZE(efm32_uart_ports))
- efm32_uart_ports[pdev->id] = NULL;
+ if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
+ efm32_uart_ports[line] = NULL;
+err_probe_dt:
err_get_rxirq:
err_too_small:
err_get_base:
@@ -777,20 +781,19 @@ err_get_base:
static int efm32_uart_remove(struct platform_device *pdev)
{
struct efm32_uart_port *efm_port = platform_get_drvdata(pdev);
-
- platform_set_drvdata(pdev, NULL);
+ unsigned int line = efm_port->port.line;
uart_remove_one_port(&efm32_uart_reg, &efm_port->port);
- if (pdev->id >= 0 && pdev->id < ARRAY_SIZE(efm32_uart_ports))
- efm32_uart_ports[pdev->id] = NULL;
+ if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
+ efm32_uart_ports[line] = NULL;
kfree(efm_port);
return 0;
}
-static struct of_device_id efm32_uart_dt_ids[] = {
+static const struct of_device_id efm32_uart_dt_ids[] = {
{
.compatible = "efm32,uart",
}, {