shithub: riscv

Download patch

ref: 2ee4c089741823aae794eaa2eb53780f65019981
parent: d81f4d4866ac6084d8268880fa36bec3ece460c1
author: cinap_lenrek <[email protected]>
date: Sat Oct 27 16:00:12 EDT 2018

devuart: don't sleep in uartdrainoutput() when called splhi or without a process

uartdrainoutput() might be called in early initialization
from uartctl() without a process.

--- a/sys/src/9/port/devuart.c
+++ b/sys/src/9/port/devuart.c
@@ -318,9 +318,8 @@
 static void
 uartdrainoutput(Uart *p)
 {
-	if(!p->enabled)
+	if(!p->enabled || up == nil || !islo())
 		return;
-
 	p->drain = 1;
 	if(waserror()){
 		p->drain = 0;