aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/8250
diff options
context:
space:
mode:
authorEddie Huang <eddie.huang@mediatek.com>2014-10-22 21:12:07 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 14:57:25 -0800
commit2a768264eef098cc1355b02ca5023b6cfb183a1f (patch)
treef28fb3d93fc08248120d520ef9432c27992f90bd /drivers/tty/serial/8250
parentMAINTAINERS: Add entry for rp2 (Rocketport Express/Infinity) driver (diff)
downloadlinux-dev-2a768264eef098cc1355b02ca5023b6cfb183a1f.tar.xz
linux-dev-2a768264eef098cc1355b02ca5023b6cfb183a1f.zip
tty: serial: Fix mediatek UART driver setting baudrate issue
In mtk8250_set_termios function, calculating quot value can not be zero, otherwise, using DIV_ROUND_CLOSEST(port->uartclk, quot * baud) will fail due to divisor is zero. Signed-off-by: Eddie Huang <eddie.huang@mediatek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250')
-rw-r--r--drivers/tty/serial/8250/8250_mtk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 8f37d57165ec..6f93123a428a 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -74,14 +74,14 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
/* Set to next lower baudrate supported */
if ((baud == 500000) || (baud == 576000))
baud = 460800;
- quot = DIV_ROUND_CLOSEST(port->uartclk, 4 * baud);
+ quot = DIV_ROUND_UP(port->uartclk, 4 * baud);
} else {
serial_port_out(port, UART_MTK_HIGHS, 0x3);
/* Set to highest baudrate supported */
if (baud >= 1152000)
baud = 921600;
- quot = DIV_ROUND_CLOSEST(port->uartclk, 256 * baud);
+ quot = DIV_ROUND_UP(port->uartclk, 256 * baud);
}
/*