commit d87f9edda1ca873af130bce479528143c73e5fdc Author: Adrian Grigore Date: Sat Nov 9 15:38:33 2024 +0200 sys/src/9k/port: cope with uartnuart == 0 in devcons (thanks Geoff Collyer) diff --git a/sys/src/9k/port/devuart.c b/sys/src/9k/port/devuart.c index 4c8e03e8d..8302fc2c0 100644 --- a/sys/src/9k/port/devuart.c +++ b/sys/src/9k/port/devuart.c @@ -227,8 +227,10 @@ uartreset(void) uartnuart++; } -//fix the case of uartnuart == 0, will panic below - if(uartnuart) + /* cope with uartnuart == 0, else will panic below */ + if (uartnuart == 0) + uart = malloc(sizeof(Uart*)); /* dummy */ + else uart = malloc(uartnuart*sizeof(Uart*)); uartndir = 1 + 3*uartnuart;