shithub: riscv

Download patch

ref: 8d22d0b165ff3bc226f9027c1ecf82b34cd21cef
parent: 25493360e37474fb656eb8eea336e80bf3e99c66
author: cinap_lenrek <[email protected]>
date: Sat Feb 4 11:41:46 EST 2012

devuart: fix no memory panic with zero number of uarts

--- a/sys/src/9/port/devuart.c
+++ b/sys/src/9/port/devuart.c
@@ -194,7 +194,7 @@
 
 	uartndir = 1 + 3*uartnuart;
 	uartdir = xalloc(uartndir * sizeof(Dirtab));
-	if (uart == nil || uartdir == nil)
+	if(uartnuart && uart == nil || uartdir == nil)
 		panic("uartreset: no memory");
 	dp = uartdir;
 	strcpy(dp->name, ".");