serial: 8250: Don't crash when nr_uarts is 0
authorPhil Elwell <phil@raspberrypi.org>
Tue, 30 Jun 2015 13:12:42 +0000 (14:12 +0100)
committerRaspbian kernel package updater <root@raspbian.org>
Sat, 31 Mar 2018 14:44:47 +0000 (15:44 +0100)
drivers/tty/serial/8250/8250_core.c

index e8819aa20415603c80547e382838a8fa3ce54792..cf9c7d2e3f95e1a19410247a89c2e49c1a2747a8 100644 (file)
@@ -509,6 +509,8 @@ static void __init serial8250_isa_init_ports(void)
 
        if (nr_uarts > UART_NR)
                nr_uarts = UART_NR;
+       if (!nr_uarts)
+               return;
 
        for (i = 0; i < nr_uarts; i++) {
                struct uart_8250_port *up = &serial8250_ports[i];