summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorHugo Villeneuve <hvilleneuve@dimonoff.com>2026-04-10 11:20:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-05-11 17:19:52 +0200
commit1097aedec77674fe4f08f40b3f0bac26ea437fc0 (patch)
tree6a92926a40add03dc3caeb824d91066f41b08027 /drivers/tty
parent2f0c8853109bca54ac28e33659ce600ceb45ff12 (diff)
downloadlwn-1097aedec77674fe4f08f40b3f0bac26ea437fc0.tar.gz
lwn-1097aedec77674fe4f08f40b3f0bac26ea437fc0.zip
serial: core: simplify clipping logic in uart_get_baud_rate()
Simplify the clipping logic in uart_get_baud_rate() to improve code readability. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://patch.msgid.link/20260410152022.2146488-5-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/serial_core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index e6a8ab40442d..f89c0dc29516 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -543,11 +543,11 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
*/
if (!hung_up) {
if (baud <= min)
- tty_termios_encode_baud_rate(termios,
- min + 1, min + 1);
+ baud = min + 1;
else
- tty_termios_encode_baud_rate(termios,
- max - 1, max - 1);
+ baud = max - 1;
+
+ tty_termios_encode_baud_rate(termios, baud, baud);
}
}
return 0;