summaryrefslogtreecommitdiff
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2021-09-21 15:30:07 +0200
committerJohan Hovold <johan@kernel.org>2021-09-22 09:32:51 +0200
commita692d0e6066c9377699b88fc0555d719519e6fb0 (patch)
treecbee8acb88e2d361accc2bfca728e93b0e602465 /drivers/usb/serial
parent71b20b34afc2e709f3bbce516fbfdd9f042b607a (diff)
USB: serial: kl5kusb105: clean up line-status handling
Clean up the line-status handling by dropping redundant initialisations and returning early on errors. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/kl5kusb105.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 72d3920c9c48..7681671ddb79 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -172,8 +172,6 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
u8 status_buf[KLSI_STATUSBUF_LEN];
__u16 status;
- status_buf[0] = 0xff;
- status_buf[1] = 0xff;
rc = usb_control_msg_recv(port->serial->dev, 0,
KL5KUSB105A_SIO_POLL,
USB_TYPE_VENDOR | USB_DIR_IN,
@@ -184,16 +182,17 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
GFP_KERNEL);
if (rc) {
dev_err(&port->dev, "reading line status failed: %d\n", rc);
- } else {
- status = get_unaligned_le16(status_buf);
+ return rc;
+ }
- dev_dbg(&port->dev, "read status %02x %02x\n",
- status_buf[0], status_buf[1]);
+ status = get_unaligned_le16(status_buf);
- *line_state_p = klsi_105_status2linestate(status);
- }
+ dev_dbg(&port->dev, "read status %02x %02x\n",
+ status_buf[0], status_buf[1]);
- return rc;
+ *line_state_p = klsi_105_status2linestate(status);
+
+ return 0;
}