From 281a077578b7ca97f028e1e652107245e397a40b Mon Sep 17 00:00:00 2001 From: marcel Date: Sun, 23 Apr 2006 21:15:07 +0000 Subject: MFp4: Calculate the divisor before setting the DLAB bit. This prevents that there's a control flow that leaves the DLAB bit set. --- sys/dev/uart/uart_dev_ns8250.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/dev/uart') 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); } -- cgit v1.1