aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/efm32-uart.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2013-07-30 10:35:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-31 21:05:39 -0400
commit11f1ad3ab4c2b2f208f7ef5b0360903bdf00df61 (patch)
tree75e5141b118890ba818286e36fe9feab53e815f5 /drivers/tty/serial/efm32-uart.c
parent574de559c1797618fd8ed03576837eb3113c5d26 (diff)
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.c17
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)
698{ 698{
699 struct efm32_uart_port *efm_port; 699 struct efm32_uart_port *efm_port;
700 struct resource *res; 700 struct resource *res;
701 unsigned int line;
701 int ret; 702 int ret;
702 703
703 efm_port = kzalloc(sizeof(*efm_port), GFP_KERNEL); 704 efm_port = kzalloc(sizeof(*efm_port), GFP_KERNEL);
@@ -752,16 +753,17 @@ static int efm32_uart_probe(struct platform_device *pdev)
752 efm_port->pdata = *pdata; 753 efm_port->pdata = *pdata;
753 } 754 }
754 755
755 if (efm_port->port.line >= 0 && 756 line = efm_port->port.line;
756 efm_port->port.line < ARRAY_SIZE(efm32_uart_ports)) 757
757 efm32_uart_ports[efm_port->port.line] = efm_port; 758 if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
759 efm32_uart_ports[line] = efm_port;
758 760
759 ret = uart_add_one_port(&efm32_uart_reg, &efm_port->port); 761 ret = uart_add_one_port(&efm32_uart_reg, &efm_port->port);
760 if (ret) { 762 if (ret) {
761 dev_dbg(&pdev->dev, "failed to add port: %d\n", ret); 763 dev_dbg(&pdev->dev, "failed to add port: %d\n", ret);
762 764
763 if (pdev->id >= 0 && pdev->id < ARRAY_SIZE(efm32_uart_ports)) 765 if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
764 efm32_uart_ports[pdev->id] = NULL; 766 efm32_uart_ports[line] = NULL;
765err_get_rxirq: 767err_get_rxirq:
766err_too_small: 768err_too_small:
767err_get_base: 769err_get_base:
@@ -777,11 +779,12 @@ err_get_base:
777static int efm32_uart_remove(struct platform_device *pdev) 779static int efm32_uart_remove(struct platform_device *pdev)
778{ 780{
779 struct efm32_uart_port *efm_port = platform_get_drvdata(pdev); 781 struct efm32_uart_port *efm_port = platform_get_drvdata(pdev);
782 unsigned int line = efm_port->port.line;
780 783
781 uart_remove_one_port(&efm32_uart_reg, &efm_port->port); 784 uart_remove_one_port(&efm32_uart_reg, &efm_port->port);
782 785
783 if (pdev->id >= 0 && pdev->id < ARRAY_SIZE(efm32_uart_ports)) 786 if (line >= 0 && line < ARRAY_SIZE(efm32_uart_ports))
784 efm32_uart_ports[pdev->id] = NULL; 787 efm32_uart_ports[line] = NULL;
785 788
786 kfree(efm_port); 789 kfree(efm_port);
787 790