Skip to content

Commit a692d0e

Browse files
committed
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 <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 71b20b3 commit a692d0e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/usb/serial/kl5kusb105.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
172172
u8 status_buf[KLSI_STATUSBUF_LEN];
173173
__u16 status;
174174

175-
status_buf[0] = 0xff;
176-
status_buf[1] = 0xff;
177175
rc = usb_control_msg_recv(port->serial->dev, 0,
178176
KL5KUSB105A_SIO_POLL,
179177
USB_TYPE_VENDOR | USB_DIR_IN,
@@ -184,16 +182,17 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
184182
GFP_KERNEL);
185183
if (rc) {
186184
dev_err(&port->dev, "reading line status failed: %d\n", rc);
187-
} else {
188-
status = get_unaligned_le16(status_buf);
185+
return rc;
186+
}
189187

190-
dev_dbg(&port->dev, "read status %02x %02x\n",
191-
status_buf[0], status_buf[1]);
188+
status = get_unaligned_le16(status_buf);
192189

193-
*line_state_p = klsi_105_status2linestate(status);
194-
}
190+
dev_dbg(&port->dev, "read status %02x %02x\n",
191+
status_buf[0], status_buf[1]);
195192

196-
return rc;
193+
*line_state_p = klsi_105_status2linestate(status);
194+
195+
return 0;
197196
}
198197

199198

0 commit comments

Comments
 (0)