Skip to contentSkip to conversation

USB: serial: cp210x: fix tiocmget error handling

PATCH New Johan Hovold 1 participant 1 message Oct 19, 2016

Subsystems (3)
lore
Share & tools
lore

Johan Hovold

author maintainer
#0 lore raw

PATCH 1/1 USB: serial: cp210x: fix tiocmget error handling

The current tiocmget implementation would fail to report errors up the stack and instead leaked a few bits from the stack as a mask of modem-status flags.

Fixes 39a66b8d22a3 ("[PATCH] USB: CP2101 Add support for flow control")
Cc stable <[email protected]>
---
 drivers/usb/serial/cp210x.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/serial/cp210x.c +3 -1
index 54a4de0efdba..f61477bed3a8 100644
@@ -1077,7 +1077,9 @@ static int cp210x_tiocmget(struct tty_struct *tty)
 	u8 control;
 	int result;
 
-	cp210x_read_u8_reg(port, CP210X_GET_MDMSTS, &control);
+	result = cp210x_read_u8_reg(port, CP210X_GET_MDMSTS, &control);
+	if (result)
+		return result;
 
 	result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
 		|((control & CONTROL_RTS) ? TIOCM_RTS : 0)
Signature · 1 line
2.7.3