Commit 85a2af9f authored by Johan Hovold's avatar Johan Hovold Committed by Sasha Levin

USB: serial: cp210x: fix tiocmget error handling

[ Upstream commit de24e0a1 ]

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: 39a66b8d ("[PATCH] USB: CP2101 Add support for flow control")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 0854ce49
...@@ -844,7 +844,9 @@ static int cp210x_tiocmget(struct tty_struct *tty) ...@@ -844,7 +844,9 @@ static int cp210x_tiocmget(struct tty_struct *tty)
unsigned int control; unsigned int control;
int result; int result;
cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1); result = cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1);
if (result)
return result;
result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0) result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
|((control & CONTROL_RTS) ? TIOCM_RTS : 0) |((control & CONTROL_RTS) ? TIOCM_RTS : 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment