提交 871996ed 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: pl2303: enforce baud-rate limits before lookup

Enforce any baud-rate limits before doing table lookup.
Signed-off-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 59afe10e
......@@ -351,6 +351,9 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty,
dev_dbg(&port->dev, "baud requested = %u\n", baud);
if (!baud)
return;
if (spriv->type->max_baud_rate)
baud = min_t(speed_t, baud, spriv->type->max_baud_rate);
/*
* Set baud rate to nearest supported value.
*
......@@ -359,9 +362,6 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty,
*/
baud = pl2303_get_supported_baud_rate(baud);
if (spriv->type->max_baud_rate)
baud = min_t(speed_t, baud, spriv->type->max_baud_rate);
if (baud <= 115200) {
put_unaligned_le32(baud, buf);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部