summary refs log tree commit diff
path: root/drivers/tty
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2011-02-09 10:56:52 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-17 11:31:58 -0800
commite96fabd8791aad30a3c8a03919893ae3e2e3df25 (patch)
treee83e2647b1dcf240d24bf85b6e0906be2a4a0440 /drivers/tty
parentd637837583163a1a70331ce48097f697cac85e32 (diff)
downloadlinux-e96fabd8791aad30a3c8a03919893ae3e2e3df25.tar.gz
tty: serial: altera_uart: Handle pdev->id == -1 in altera_uart_remove
Commit 6b5756f176568a710d008d3b478128fafb6707f0 introduced the
possibility for pdev->id being -1 but the change was not done equally in
altera_uart_remove. This patch fixes this.

Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/altera_uart.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 721216292a50..dee7a0eb6ea1 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -561,9 +561,15 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
 
 static int __devexit altera_uart_remove(struct platform_device *pdev)
 {
-	struct uart_port *port = &altera_uart_ports[pdev->id].port;
+	struct uart_port *port;
+	int i = pdev->id;
 
+	if (i == -1)
+		i = 0;
+
+	port = &altera_uart_ports[i].port;
 	uart_remove_one_port(&altera_uart_driver, port);
+
 	return 0;
 }