Skip to content

Commit a313249

Browse files
cleitnergregkh
authored andcommitted
USB: pl2303: fixed handling of CS5 setting
This patch fixes the CS5 setting on the PL2303 USB-to-serial devices. CS5 has a value of 0 and the CSIZE setting has been skipped altogether by the enclosing if. Tested on 3.11.6 and the scope shows the correct output after the fix has been applied. Tagged to be added to stable, because it fixes a user visible driver bug and is simple enough to backport easily. Signed-off-by: Colin Leitner <colin.leitner@gmail.com> Signed-off-by: Johan Hovold <jhovold@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8704211 commit a313249

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

‎drivers/usb/serial/pl2303.c‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -361,23 +361,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
361361
0, 0, buf, 7, 100);
362362
dev_dbg(&port->dev, "0xa1:0x21:0:0 %d - %7ph\n", i, buf);
363363

364-
if (C_CSIZE(tty)) {
365-
switch (C_CSIZE(tty)) {
366-
case CS5:
367-
buf[6] = 5;
368-
break;
369-
case CS6:
370-
buf[6] = 6;
371-
break;
372-
case CS7:
373-
buf[6] = 7;
374-
break;
375-
default:
376-
case CS8:
377-
buf[6] = 8;
378-
}
379-
dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
364+
switch (C_CSIZE(tty)) {
365+
case CS5:
366+
buf[6] = 5;
367+
break;
368+
case CS6:
369+
buf[6] = 6;
370+
break;
371+
case CS7:
372+
buf[6] = 7;
373+
break;
374+
default:
375+
case CS8:
376+
buf[6] = 8;
380377
}
378+
dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
381379

382380
/* For reference buf[0]:buf[3] baud rate value */
383381
pl2303_encode_baudrate(tty, port, &buf[0]);

0 commit comments

Comments
 (0)