Skip to content

Commit

Permalink
Merge tag 'usb-serial-5.6-rc2' of https://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/johan/usb-serial into usb-linus

Johan writes:

USB-serial fixes for 5.6-rc2

Here's a fix for a ch341 regression in 5.5 which people have started to
hit, and a fix for a logic error in an ir-usb error path.

Both have been in linux-next with no reported issues.

Signed-off-by: Johan Hovold <johan@kernel.org>

* tag 'usb-serial-5.6-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial:
  USB: serial: ch341: fix receiver regression
  USB: serial: ir-usb: Silence harmless uninitialized variable warning
  • Loading branch information
Greg Kroah-Hartman committed Feb 13, 2020
2 parents 57d7713 + 7c3d022 commit d593126
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions drivers/usb/serial/ch341.c
Original file line number Diff line number Diff line change
@@ -205,6 +205,16 @@ static int ch341_get_divisor(speed_t speed)
16 * speed - 16 * CH341_CLKRATE / (clk_div * (div + 1)))
div++;

/*
* Prefer lower base clock (fact = 0) if even divisor.
*
* Note that this makes the receiver more tolerant to errors.
*/
if (fact == 1 && div % 2 == 0) {
div /= 2;
fact = 0;
}

return (0x100 - div) << 8 | fact << 2 | ps;
}

2 changes: 1 addition & 1 deletion drivers/usb/serial/ir-usb.c
Original file line number Diff line number Diff line change
@@ -448,7 +448,7 @@ static void ir_set_termios(struct tty_struct *tty,
usb_sndbulkpipe(udev, port->bulk_out_endpointAddress),
transfer_buffer, 1, &actual_length, 5000);
if (ret || actual_length != 1) {
if (actual_length != 1)
if (!ret)
ret = -EIO;
dev_err(&port->dev, "failed to change line speed: %d\n", ret);
}

0 comments on commit d593126

Please sign in to comment.