aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/max3100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/max3100.c')
-rw-r--r--drivers/tty/serial/max3100.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index 46043c2521c..0f24486be53 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -827,14 +827,16 @@ static int __devexit max3100_remove(struct spi_device *spi)
827 827
828 /* find out the index for the chip we are removing */ 828 /* find out the index for the chip we are removing */
829 for (i = 0; i < MAX_MAX3100; i++) 829 for (i = 0; i < MAX_MAX3100; i++)
830 if (max3100s[i] == s) 830 if (max3100s[i] == s) {
831 dev_dbg(&spi->dev, "%s: removing port %d\n", __func__, i);
832 uart_remove_one_port(&max3100_uart_driver, &max3100s[i]->port);
833 kfree(max3100s[i]);
834 max3100s[i] = NULL;
831 break; 835 break;
836 }
832 837
833 dev_dbg(&spi->dev, "%s: removing port %d\n", __func__, i); 838 WARN_ON(i == MAX_MAX3100);
834 uart_remove_one_port(&max3100_uart_driver, &max3100s[i]->port); 839
835 kfree(max3100s[i]);
836 max3100s[i] = NULL;
837
838 /* check if this is the last chip we have */ 840 /* check if this is the last chip we have */
839 for (i = 0; i < MAX_MAX3100; i++) 841 for (i = 0; i < MAX_MAX3100; i++)
840 if (max3100s[i]) { 842 if (max3100s[i]) {