[PATCH] serial: rsci: Remove goto and refactor baud rate clock selection

From: Biju

Date: Tue Apr 07 2026 - 11:14:37 EST


From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Replace the early-exit goto pattern in rsci_set_termios() with a
positive conditional block. When baud rate is zero, the clock
selection logic is now simply skipped rather than jumping to a
'done' label, eliminating the goto entirely.

No functional change intended.

Reported-by: Pavel Machek <pavel@xxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/abPpZULsXhRmXTX9@xxxxxxxxxx/
Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
---
drivers/tty/serial/rsci.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/rsci.c b/drivers/tty/serial/rsci.c
index b00c9e385169..0b92173f8f45 100644
--- a/drivers/tty/serial/rsci.c
+++ b/drivers/tty/serial/rsci.c
@@ -265,20 +265,18 @@ static void rsci_set_termios(struct uart_port *port, struct ktermios *termios,
}

baud = uart_get_baud_rate(port, termios, old, 0, max_freq);
- if (!baud)
- goto done;
-
- /* Divided Functional Clock using standard Bit Rate Register */
- err = sci_scbrr_calc(s, baud, &brr1, &srr1, &cks1);
- if (abs(err) < abs(min_err)) {
- best_clk = SCI_FCK;
- ccr0_val = 0;
- min_err = err;
- brr = brr1;
- cks = cks1;
+ if (baud) {
+ /* Divided Functional Clock using standard Bit Rate Register */
+ err = sci_scbrr_calc(s, baud, &brr1, &srr1, &cks1);
+ if (abs(err) < abs(min_err)) {
+ best_clk = SCI_FCK;
+ ccr0_val = 0;
+ min_err = err;
+ brr = brr1;
+ cks = cks1;
+ }
}

-done:
if (best_clk >= 0)
dev_dbg(port->dev, "Using clk %pC for %u%+d bps\n",
s->clks[best_clk], baud, min_err);
--
2.43.0