Skip to contentSkip to conversation

USB: pl2303: fixed handling of CS5 setting

PATCH In review Colin Leitner 3 participants 3 messages Nov 4, 2013 – Nov 5, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/usb/serial/pl2303.c |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/usb/serial/pl2303.c +14 -16
index 1e6de4c..1e3318d 100644
@@ -361,23 +361,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
 			    0, 0, buf, 7, 100);
 	dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);
 
-	if (C_CSIZE(tty)) {
-		switch (C_CSIZE(tty)) {
-		case CS5:
-			buf[6] = 5;
-			break;
-		case CS6:
-			buf[6] = 6;
-			break;
-		case CS7:
-			buf[6] = 7;
-			break;
-		default:
-		case CS8:
-			buf[6] = 8;
-		}
-		dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
+	switch (C_CSIZE(tty)) {
+	case CS5:
+		buf[6] = 5;
+		break;
+	case CS6:
+		buf[6] = 6;
+		break;
+	case CS7:
+		buf[6] = 7;
+		break;
+	default:
+	case CS8:
+		buf[6] = 8;
 	}
+	dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
 
 	/* For reference buf[0]:buf[3] baud rate value */
 	pl2303_encode_baudrate(tty, port, &buf[0]);
Signature · 5 lines
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 7 lines · Colin Leitner

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.

Thanks! Now it applies cleanly to v3.12.

Greg, can you pick this one up for v3.13-rc? The fix could be backported to all stable trees as the bug has been there since pre-git times.

Quoted 2 lines
Quoted 48 lines
---
 drivers/usb/serial/pl2303.c |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/usb/serial/pl2303.c +14 -16
index 1e6de4c..1e3318d 100644
@@ -361,23 +361,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
 			    0, 0, buf, 7, 100);
 	dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);
 
-	if (C_CSIZE(tty)) {
-		switch (C_CSIZE(tty)) {
-		case CS5:
-			buf[6] = 5;
-			break;
-		case CS6:
-			buf[6] = 6;
-			break;
-		case CS7:
-			buf[6] = 7;
-			break;
-		default:
-		case CS8:
-			buf[6] = 8;
-		}
-		dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
+	switch (C_CSIZE(tty)) {
+	case CS5:
+		buf[6] = 5;
+		break;
+	case CS6:
+		buf[6] = 6;
+		break;
+	case CS7:
+		buf[6] = 7;
+		break;
+	default:
+	case CS8:
+		buf[6] = 8;
 	}
+	dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
 
 	/* For reference buf[0]:buf[3] baud rate value */
 	pl2303_encode_baudrate(tty, port, &buf[0]);
Signature · 1 line
1.7.10.4
maintainer
#2 lore raw
Quoted 11 lines · Johan Hovold
Quoted 7 lines · Colin Leitner

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.

Thanks! Now it applies cleanly to v3.12.

Quoted 7 lines

Greg, can you pick this one up for v3.13-rc? The fix could be backported to all stable trees as the bug has been there since pre-git times.

Quoted 2 lines

Thanks, I'll pick this up after 3.13-rc1 is out and get it into the stable kernels as well.

greg k-h