Commit 1524ceb1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'usb-serial-6.1-rc8' of...

Merge tag 'usb-serial-6.1-rc8' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial fixes for 6.1-rc8

Here are two fixes for a division-by-zero issue in the Fintek drivers.

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

* tag 'usb-serial-6.1-rc8' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial:
  USB: serial: f81534: fix division by zero on line-speed change
  USB: serial: f81232: fix division by zero on line-speed change
parents 7428a253 188c9c2e
......@@ -130,9 +130,6 @@ static u8 const clock_table[] = { F81232_CLK_1_846_MHZ, F81232_CLK_14_77_MHZ,
static int calc_baud_divisor(speed_t baudrate, speed_t clockrate)
{
if (!baudrate)
return 0;
return DIV_ROUND_CLOSEST(clockrate, baudrate);
}
......@@ -498,9 +495,14 @@ static void f81232_set_baudrate(struct tty_struct *tty,
speed_t baud_list[] = { baudrate, old_baudrate, F81232_DEF_BAUDRATE };
for (i = 0; i < ARRAY_SIZE(baud_list); ++i) {
idx = f81232_find_clk(baud_list[i]);
baudrate = baud_list[i];
if (baudrate == 0) {
tty_encode_baud_rate(tty, 0, 0);
return;
}
idx = f81232_find_clk(baudrate);
if (idx >= 0) {
baudrate = baud_list[i];
tty_encode_baud_rate(tty, baudrate, baudrate);
break;
}
......
......@@ -536,9 +536,6 @@ static int f81534_submit_writer(struct usb_serial_port *port, gfp_t mem_flags)
static u32 f81534_calc_baud_divisor(u32 baudrate, u32 clockrate)
{
if (!baudrate)
return 0;
/* Round to nearest divisor */
return DIV_ROUND_CLOSEST(clockrate, baudrate);
}
......@@ -568,9 +565,14 @@ static int f81534_set_port_config(struct usb_serial_port *port,
u32 baud_list[] = {baudrate, old_baudrate, F81534_DEFAULT_BAUD_RATE};
for (i = 0; i < ARRAY_SIZE(baud_list); ++i) {
idx = f81534_find_clk(baud_list[i]);
baudrate = baud_list[i];
if (baudrate == 0) {
tty_encode_baud_rate(tty, 0, 0);
return 0;
}
idx = f81534_find_clk(baudrate);
if (idx >= 0) {
baudrate = baud_list[i];
tty_encode_baud_rate(tty, baudrate, baudrate);
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment