diff options
author | marcel <marcel@FreeBSD.org> | 2006-04-23 21:15:07 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2006-04-23 21:15:07 +0000 |
commit | 281a077578b7ca97f028e1e652107245e397a40b (patch) | |
tree | 857214fec4ce48d4f1a13936c90dce3ac7489824 /sys/dev/uart/uart_dev_ns8250.c | |
parent | e41bbcfa829c3cc4be4a4a5f328b1ece509030af (diff) | |
download | FreeBSD-src-281a077578b7ca97f028e1e652107245e397a40b.zip FreeBSD-src-281a077578b7ca97f028e1e652107245e397a40b.tar.gz |
MFp4: Calculate the divisor before setting the DLAB bit. This
prevents that there's a control flow that leaves the DLAB
bit set.
Diffstat (limited to 'sys/dev/uart/uart_dev_ns8250.c')
-rw-r--r-- | sys/dev/uart/uart_dev_ns8250.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 968f3d7..9945194 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -194,11 +194,11 @@ ns8250_param(struct uart_bas *bas, int baudrate, int databits, int stopbits, /* Set baudrate. */ if (baudrate > 0) { - uart_setreg(bas, REG_LCR, lcr | LCR_DLAB); - uart_barrier(bas); divisor = ns8250_divisor(bas->rclk, baudrate); if (divisor == 0) return (EINVAL); + uart_setreg(bas, REG_LCR, lcr | LCR_DLAB); + uart_barrier(bas); uart_setdreg(bas, REG_DL, divisor); uart_barrier(bas); } |