mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-16 03:28:40 +00:00
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>
This commit is contained in:
parent
cd8db057e9
commit
b5fda434b1
1 changed files with 2 additions and 6 deletions
|
@ -449,7 +449,7 @@ static int pl2303_get_line_request(struct usb_serial_port *port,
|
||||||
if (ret != 7) {
|
if (ret != 7) {
|
||||||
dev_err(&port->dev, "%s - failed: %d\n", __func__, ret);
|
dev_err(&port->dev, "%s - failed: %d\n", __func__, ret);
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret >= 0)
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
|
||||||
return ret;
|
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),
|
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||||
SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE,
|
SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE,
|
||||||
0, 0, buf, 7, 100);
|
0, 0, buf, 7, 100);
|
||||||
if (ret != 7) {
|
if (ret < 0) {
|
||||||
dev_err(&port->dev, "%s - failed: %d\n", __func__, ret);
|
dev_err(&port->dev, "%s - failed: %d\n", __func__, ret);
|
||||||
|
|
||||||
if (ret > 0)
|
|
||||||
ret = -EIO;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue