summaryrefslogtreecommitdiff
path: root/sys/dev/sio/sio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sio/sio.c')
-rw-r--r--sys/dev/sio/sio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index de38f2fdfbca..d98ef8965a8d 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -1233,6 +1233,7 @@ open_top:
* XXX we should goto open_top if comparam() slept.
*/
if (com->hasfifo) {
+ int i;
/*
* (Re)enable and drain fifos.
*
@@ -1244,7 +1245,7 @@ open_top:
* and to handle races between enabling and fresh
* input.
*/
- while (TRUE) {
+ for (i = 0; i < 500; i++) {
sio_setreg(com, com_fifo,
FIFO_RCV_RST | FIFO_XMT_RST
| com->fifo_image);
@@ -1266,6 +1267,10 @@ open_top:
DELAY(50);
(void) inb(com->data_port);
}
+ if (i == 500) {
+ error = EIO;
+ goto out;
+ }
}
mtx_lock_spin(&sio_lock);