diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-07-30 16:35:20 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-31 18:05:39 -0700 |
commit | 11f1ad3ab4c2b2f208f7ef5b0360903bdf00df61 (patch) | |
tree | 75e5141b118890ba818286e36fe9feab53e815f5 /drivers/tty/serial/efm32-uart.c | |
parent | 574de559c1797618fd8ed03576837eb3113c5d26 (diff) | |
download | linux-11f1ad3ab4c2b2f208f7ef5b0360903bdf00df61.tar.bz2 |
serial/efm32-uart: don't use pdev->id to determine the port's line
pdev->id is not a valid choice for device-tree probed devices. So use
the (properly determined) line from efm32_uart_probe consistenly
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/efm32-uart.c')
-rw-r--r-- | drivers/tty/serial/efm32-uart.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index 868dbfb9f893..ce1ebbb0fe0d 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c @@ -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); @@ -752,16 +753,17 @@ static int efm32_uart_probe(struct platform_device *pdev) efm_port->pdata = *pdata; } - if (efm_port->port.line >= 0 && - efm_port->port.line < ARRAY_SIZE(efm32_uart_ports)) - efm32_uart_ports[efm_port->port.line] = efm_port; + line = efm_port->port.line; + + 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_get_rxirq: err_too_small: err_get_base: @@ -777,11 +779,12 @@ err_get_base: static int efm32_uart_remove(struct platform_device *pdev) { struct efm32_uart_port *efm_port = platform_get_drvdata(pdev); + 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); |