summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/pl2303.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-12-29 19:23:12 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-03 12:31:48 -0800
commit871996ede12306cd1d75ed8135bed6f1fcbcd0e6 (patch)
treef3b1b7bcf80f1eced6c311d448aeb9ec4fafd8da /drivers/usb/serial/pl2303.c
parent59afe10e8dd33d26f8c2ae7572f9023044e71bab (diff)
USB: pl2303: enforce baud-rate limits before lookup
Enforce any baud-rate limits before doing table lookup. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/pl2303.c')
-rw-r--r--drivers/usb/serial/pl2303.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 9a95b92310f2..394903b4ecb7 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -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 {