summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/pl2303.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-01-12 14:56:19 +0100
committerJohan Hovold <johan@kernel.org>2017-01-16 16:38:56 +0100
commitb5fda434b13de8328c57421e31ac91d401c93b97 (patch)
treeceb3b071d177b8a8b07c498b1bd6d8e1302e0dc9 /drivers/usb/serial/pl2303.c
parentcd8db057e93ddaacbec025b567490555d2bca280 (diff)
downloadlinux-b5fda434b13de8328c57421e31ac91d401c93b97.tar.gz
linux-b5fda434b13de8328c57421e31ac91d401c93b97.tar.bz2
linux-b5fda434b13de8328c57421e31ac91d401c93b97.zip
USB: serial: pl2303: fix line-setting error handling
Make sure to return an error on zero-length transfers when retrieving the line settings even if the driver currently ignores the return value. Also remove a redundant check for short transfer when setting the line settings. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/pl2303.c')
-rw-r--r--drivers/usb/serial/pl2303.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 46fca6b75846..3ba713570c6b 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -449,7 +449,7 @@ static int pl2303_get_line_request(struct usb_serial_port *port,
if (ret != 7) {
dev_err(&port->dev, "%s - failed: %d\n", __func__, ret);
- if (ret > 0)
+ if (ret >= 0)
ret = -EIO;
return ret;
@@ -469,12 +469,8 @@ static int pl2303_set_line_request(struct usb_serial_port *port,
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE,
0, 0, buf, 7, 100);
- if (ret != 7) {
+ if (ret < 0) {
dev_err(&port->dev, "%s - failed: %d\n", __func__, ret);
-
- if (ret > 0)
- ret = -EIO;
-
return ret;
}