summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2011-03-23 15:51:12 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2011-03-23 15:51:12 +0000
commitf4b10ad52387a64ea980b75be698e1fc8f99138b (patch)
tree62592d0166d10209e47971605616a52a95eea6ec /sys/dev/ic
parenta8c717e203b141524e545fb64da3e74a0a0ab97b (diff)
only read from the UART if there is something to read. fix beagle, otherwise
it will crash with 'External Non-Linefetch Abort (S)'. similar diff provided by drahn@. tested by jasper@, deraadt@ ok.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/com.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index e8f51ee8dc8..a85ddb5989d 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.145 2010/08/28 12:48:14 miod Exp $ */
+/* $OpenBSD: com.c,v 1.146 2011/03/23 15:51:11 fgsch Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -1789,7 +1789,8 @@ com_attach_subr(struct com_softc *sc)
/* clear and disable fifo */
bus_space_write_1(iot, ioh, com_fifo, FIFO_RCV_RST | FIFO_XMT_RST);
- (void)bus_space_read_1(iot, ioh, com_data);
+ if (ISSET(bus_space_read_1(iot, ioh, com_lsr), LSR_RXRDY))
+ (void)bus_space_read_1(iot, ioh, com_data);
bus_space_write_1(iot, ioh, com_fifo, 0);
sc->sc_mcr = 0;